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 :)
****************Summary******************
The program for above queation is given below with comments...and output....
Explanation is in comments....
I hope it works for you :) !!!!!!!!!!!!!
Feel free to ask for help in comments......I would be happy to help!
****************Program*****************
#taking float value from user
CalPerMin=float(input("How many calories burned per minute ? :"))
#setting value of minutes and calories to 0
minutes=0
calories=0
#while loop to calculate the minutes
while calories<100: #run loop until the calories value is less than 100
#increase minutes and calorie by CalPerMin
calories=calories+CalPerMin #add calories per minute in calories
minutes=minutes+1 #increment minutes by 1
#print the minutes took to burn 100 calories
print(minutes,"minutes")
******************Output*******************