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如何將變量轉換爲整數?我再次道歉,我覺得這是非常基本的! –