Respuesta :
Answer:
def get_age():
age = int(input())
if(age>=18 and age<=75):
return age
else:
raise ValueError("Invalid age.")
def fat_burning_heart_rate(age):
return ((70 / 100) * (220 - age))
if __name__ == '__main__':
try:
age = get_age()
print("Fat burning heart rate for a",age,"year-old:",fat_burning_heart_rate(age),"bpm")
except ValueError as ve:
print(ve.args[0])
print("Could not calculate heart rate info.")
Explanation:
def get_age():
age = int(input())
if(age>=18 and age<=75):
return age
else:
raise ValueError("Invalid age.")
def fat_burning_heart_rate(age):
return ((70 / 100) * (220 - age))
if __name__ == '__main__':
try:
age = get_age()
print("Fat burning heart rate for a",age,"year-old:",fat_burning_heart_rate(age),"bpm")
except ValueError as ve:
print(ve.args[0])
print("Could not calculate heart rate info.")
The above program performs an operation to determine the percentage of fat burning rate.
It takes the value of the ages of some adult as input, performs a series of conditional statement function on them. Before given an output .
Kindly check attachment for output

The program is an illustration of exceptions.
Exceptions are used to manage errors in programs.
The program in Python, where comments are used to explain each line is as follows:
#This defines the get_age function
def get_age():
#This gets input for age
age = int(input("Age: "))
#This returns the age if it is between 18 and 75 (inclusive)
if(age>=18 and age<=75):
return age
#If otherwise, it returns the ValueError
else:
raise ValueError("Age is out of range or invalid")
#This defines the fat_burning_heart_rate function
def fat_burning_heart_rate(age):
#This returns the fat_burning_heart_rate
return (0.7 * (220 - age))
#The main begins here
#This begins the try block
try:
#This gets input for age
age = get_age()
#This prints the fat burning heart rate
print("Fat burning heart rate for a",age,"year-old:",fat_burning_heart_rate(age),"bpm")
#This begins the exception block
except ValueError as ve:
#This prints the errors
print(ve.args[0]; "Cculd not calculate heart rate info.")
At the end of the program, the heart rate or the value error is printed
Read more about similar programs at:
https://brainly.com/question/24552964?