The American College of Sports Medicine recommends that you maintain a training heart rate (THR) during an aerobic workout. Your training heart rate (THR) is computed as:
THR = (220 – your age) times 0.7 plus resting heart rate (RHR) times 0.3
Write a Python program that computes and prints to the screen the THR for the following test cases:
AGE Resting Heart Rate (RHR)
25 58
35 64
45 67
Identify all the variables and constants.
Import data for the variables
Perform the calculations
Print out the results
You may write a loop that allows your program to perform calculations for multiple inputs or you may run the program three times, once for each test case.
n=int(input('Enter number of cases: '))
for i in range(n):
print('Case {}:'.format(i+1))
age = int(input('Enter age: '))
rhr = int(input('Enter Resting Heart Rate (RHR): '))
thr= (220-age)*.7+rhr*.3
print('Calculated Trainging Heart Rate(THR):',thr)
print()
Get Answers For Free
Most questions answered within 1 hours.