In: Computer Science
Running on a particular treadmill you burn a specific number of calories per minute. Write a python program that uses a loop (you must use a loop) to display the number of minutes (as an integer) it will take to burn greater than or equal to 100 calories. For example (user input indicated in bold):
SAMPLE 1:
How many calcories burned per minute?
54.3
2 minutes
SAMPLE 2:
How many calcories burned per minute? 4.3
24 minutes
SAMPLE 3:
How many calcories burned per minute? 25
4 minutes
HINT:
Keep a counter of the number of minutes elapsed as well as the amount of calories burned. When the calories burned exceed 100, report the number of minutes :)
import math;
#while(1) means loop runs continuously
while(1):
#takes calories burned per minutes from user
cal_per_min = float(input("How many calcories burned per minute? "))
#calculates minutes required to burn calories greater than or equal to 100
#math.ceil() will return the ceiling value of the division (100/cal_per_min)
minute = math.ceil(100 / cal_per_min) ;
#prints minutes
print(minute , "minutes")