'I'm getting the right answer but for some reason its outputting my user inputs as well I'm confused as to why
The following equation estimates the average calories burned for a person when exercising, which is based on a scientific journal article (source):
Calories = ( (Age * 0.2757) + (Weight * 0.03295) + (Heart Rate * 1.0781) - 75.4991 ) * Time / 8.368
Write a program using inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output the average calories burned for a person.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('Calories: {:.2f} calories'.format(calories))
THIS IS MY CODE:
age_years = float(input("Age:"))
#this secures input from user for age in years
weight_lbs = float(input("Weight:"))
#this secures input from user for weight
heart_rate_bpm = float(input("Heart Rate:"))
#this secures heart rate from user
time_min = float(input("Time:"))
#this secures the time of activity in minutes
calories = ((age_years * 0.2757) + (weight_lbs * 0.03295) + (heart_rate_bpm * 1.0781) - 75.4991) * time_min / 8.368
#this is the formula for figuring average calories burned based on input by user
print('Calories: {:.2f} calories'.format(calories))
THIS IS THE OUTPUT I KEEP GETTING:
Age:Weight:Heart Rate:Time:Calories: 736.21 calories
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
