python 卡路里运算的程序异常
代码如下
def main():
y_or_n = input('是否退出程序y/n?')
while y_or_n != 'y':
str_imfor = input('请您输入性别,体重(kg),身高(cm),年龄用空格隔开:')
list_imfor = str_imfor.split(' ')
gender = list_imfor[0]
weight = float(list_imfor[1])
height = float(list_imfor[2])
age = int(list_imfor[3])
if gender =='男':
bmr = (13.7*weight)+(5*height)-(6.8*age)+66
elif gender =='女':
bmr = (9.6 * weight) + (1.8 * height) - (4.7 * age) + 655
else:
bmr = -1
if bmr != -1:
print('基础大卡={}',bmr)
else:
print('暂时不支持该性别')
print()
y_or_n = input('是否退出程序y/n?')
if __name__ == 'main':
main()
运行的结果
"E:\Program Files\Date python\BMRchange\venv\Scripts\python.exe" "E:/Program Files/Date python/BMRchange/BMR02.py"
Process finished with exit code 0
请问哪里出问题了呢?