66.7k views
1 vote
During the past decade ocean levels have been rising faster than in the past, an average of approximately 3.1 millimeters per year. Write a program that computes how much ocean levels are expected to rise during the next 15 years if they continue rising at this rate. Display the answer in both centimeters and inches.

1 Answer

7 votes

Answer:

Program in Python is as follows:

rise = 3.1

for i in range(1,16):

print("Rise in Year "+str(i))

cm = rise * 0.1 * i

inch = rise/25.4 * i

print(str(cm)+" centimetres")

print(str(inch)+" inches")

print

Step-by-step explanation:

This line initializes the rise of the ocean level

rise = 3.1

The following iterates from 1 to 15 (which stands for year)

for i in range(1,16):

print("Rise in Year "+str(i))

This calculates the rise in each year in centimetre

cm = rise * 0.1 * i

This calculates the rise in each year in inches

inch = rise/25.4 * i

The line prints calculated ocean rise in centimetres

print(str(cm)+" centimetres")

The line prints calculated ocean rise in inches

print(str(inch)+" inches")

print

User TDJoe
by
7.4k points