#嵌套条件语句
#BMI=体重/(身高**2)
uesr_weight=float(input("请输入您的体重 单位:千克:"))
uesr_fop=float(input("请输入您的身高 单位:米:"))
uesr_BMI=uesr_weight/(uesr_fop)**2
print("您的BMI值为"+str(uesr_BMI))
#偏瘦:uesr_BMI<=18.5
#正常:18.5<uesr_BMI<=25
#偏胖:25<uesr_BMI<30
#肥胖:user_BMI>30
if uesr_BMI <= 18.5:
print("此BMI值为偏瘦范围")
elif 18.5<uesr_BMI<=25:
print("此BMI值为正常范围")
elif 25<uesr_BMI<30:
print("此BMI值为偏胖范围")
else:
print("此BMI值为肥胖范围")
以上是我自己按照教程编写的代码,谢谢。