def male_resting_metabolic_rate(weight,height,age):
'''Takes in the weight, height, and age of a male individual
and returns the resting metabolic rate
Example answers:
male_resting_metabolic_rate(80,180,48) = 1751'''
male_resting_metabolic_rate = int((88.4+13.4*weight)+(4.8*height)-(5.68* age))
if __name__ == "__main__":
print("This program will calculate the resting metabolic rate of an individual")
#Gather the inputs for the functions
weight = input("What is your weight in kilograms?")
height = input("What is your height in centimeters?")
age = int(input("What is your age?" + "(between 1-110):"))
print("Your resting metabolic rate is",male_resting_metabolic_rate(input,input,input))
为什么说第10行和第24行有错误?如果答案相当明显,那么我对此表示歉意。
答案 0 :(得分:-1)
发现至少两个错误:您需要使用&#34返回值;返回"在python中。您还需要按名称传递参数而不是"输入"
试试这个:
def male_resting_metabolic_rate(weight,height,age):
'''Takes in the weight, height, and age of a male individual
and returns the resting metabolic rate
Example answers:
male_resting_metabolic_rate(80,180,48) = 1751'''
return int((88.4+13.4*weight)+(4.8*height)-(5.68* age))
if __name__ == "__main__":
print("This program will calculate the resting metabolic rate of an individual")
#Gather the inputs for the functions
weight = float(input("What is your weight in kilograms?"))
height = float(input("What is your height in centimeters?"))
age = int(input("What is your age?" + "(between 1-110):"))
print("Your resting metabolic rate is",male_resting_metabolic_rate(weight, height, age ))