中国大学 MOOC 课程 《Python 语言程序设计》 课后练习(第 4 周)
weight=input("请输入你的体重:")
height=input("请输入你的身高:")
BMI=float(weight)/(float(height)**2)
x=["国内标准","国际标准"]
def china():
if BMI < 18.5:
print("你的BMI={0:.1f},偏瘦,{1}".format(BMI,x[0]))
elif BMI < 24 and BMI >=18.5:
print("你的BMI={0:.1f},正常,{1}".format(BMI,x[0]))
elif BMI < 28 and BMI >=24:
print("你的BMI={0:.1f},偏胖,{1}".format(BMI,x[0]))
elif BMI >= 28:
print("你的BMI={0:.1f},肥胖,{1}".format(BMI,x[0]))
def international():
if BMI < 18.5:
print("你的BMI={0:.1f},偏瘦,{1}".format(BMI,x[1]))
elif BMI < 25 and BMI >=18.5:
print("你的BMI={0:.1f},正常,{1}".format(BMI,x[1]))
elif BMI < 30 and BMI >=25:
print("你的BMI={0:.1f},偏胖,{1}".format(BMI,x[1]))
elif BMI >=30:
print("你的BMI={0:.1f},肥胖,{1}".format(BMI,x[1]))
china()
international()