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行有错误?超新的这个,所以我很抱歉,如果答案相当明显。TypeError:*:'float'和'builtin_function_or_method'的不受支持的操作数类型
'输入,输入,input':3倍'input'方法,而不是你在上面定义的变量!你也错过了2个变量的整数转换。 –
这里有很多问题。首先是'input'返回一个字符串,所以你需要将权重转换为数值,然后再乘以它。 'male_resting_metabolic_rate(input,input,input))'没有意义,你想做什么? – roganjosh
@ Jean-FrançoisFabre如何将变量转换为整数?我再次道歉,我觉得这是非常基本的! –