1:39 PM .oooo Sprint 43% In order for excercise to be beneficial to the cardiova
ID: 3861535 • Letter: 1
Question
1:39 PM .oooo Sprint 43% In order for excercise to be beneficial to the cardiovascular system, the heart rate (number of hear beats per minute) must exceed a value called the training hear reate, THR. A person's THR can be calculated from his or her age and resting heart rate (pulse rate when first awakening) as follows (a) calculate the maximum hear rate as 220- age. (b) subtract the resting heart rate from the maximum heart rate (c) multiply the result in step (b) by 60% and then add the resting heart rate. write a program to request a person's age and resting heart rate as input and display his or her THR.Explanation / Answer
Code is as below
# Python Program - Calculate TrainingHeartRate
Age = input("Enter your age: ")
rhr = input("Enter your resting heart rate: ")
YourAge = int(Age)
RestingHeartRate = int(rhr)
MaxHeartRate = 220 - YourAge
THR=(MaxHeartRate-RestingHeartRate)*0.6+RestingHeartRate
print("Training Heart Rate:",THR," ")
Output for Test 1:
Output for Test 2:
Output for Test 3:
The formula is derived from the explaination given.
As Pyton accepts input as a string it is converted to integer before calculation.
As the programming language is not mentioned this is done in Python as it is one of the simplest language and it is English like with less declaration statements etc.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.