Calories Burned
Running on a particular treadmill you burn 3.9 calories per minute. Write a program that uses a loop to display the number of calories burned after 10, 15, 20, 25, and 30 minutes.
COMPLETE PYTHON CODE:
# Set starting time (in minutes)
time = 10
# Loop through time increments
while time <= 30:
# Calculate the number of calories burned
calories_burned = time * 3.9
# Print results
print(f"After {time} minutes, you have burned {calories_burned} calories.")
# Increase time by 5 minutes
time += 5
OUTPUT:
After 10 minutes, you have burned 39.0 calories.
After 15 minutes, you have burned 58.5 calories.
After 20 minutes, you have burned 78.0 calories.
After 25 minutes, you have burned 97.5 calories.
After 30 minutes, you have burned 117.0 calories.