102k views
4 votes
g using pythonThe following equations estimate the calories burned when exercising (source): Men: Calories = ( (Age x 0.2017) — (Weight x 0.09036) + (Heart Rate x 0.6309) — 55.0969 ) x Time / 4.184 Women: Calories = ( (Age x 0.074) — (Weight x 0.05741) + (Heart Rate x 0.4472) — 20.4022 ) x Time / 4.184 Write a program using inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output calories burned for men and women.

User Chiyo
by
6.2k points

2 Answers

2 votes

Answer: age_years = int(input())

weight_pounds = int(input())

heart_bpm = int(input())

time_seconds = int(input())

calories_woman = ((age_years * 0.074) - (weight_pounds * 0.05741) + (heart_bpm * 0.4472) - 20.4022 ) * time_seconds / 4.184

calories_man = ((age_years * 0.2017) + (weight_pounds * 0.09036) + (heart_bpm * 0.6309) - 55.0969 ) * time_seconds / 4.184

print('Women: {:.2f} calories'.format(calories_woman))

print('Men: {:.2f} calories'.format(calories_man))

It's a simple concept and people keep replying with unneccesarily complex answers, this should 100% work

User Iodbh
by
5.0k points
4 votes

Answer:

The code in python is attached.

Step-by-step explanation:

  1. A function called CaloriesBurned is defined
  2. The function accepts 4 inputs: age,weight,heart_rate,time
  3. Two variables are assigned for the calories burned by men and women
  4. finally, the function returns the varaibles caloriesburned_men and caloriesburned_women
g using pythonThe following equations estimate the calories burned when exercising-example-1
User Vdegenne
by
5.5k points