BMI等级判断
#CalBMI.py
try:
h,w = eval(input("input hight(cm) and weight(kg):"))
except:
print("the input is wrong, should like '175,75'")
else:
bmi = w / pow(h/100, 2)
print("the bmi value is {:.8f}".format(bmi))
who,nat = "",""
if bmi < 18.5:
who,nat = "slim","slim"
elif 18.5 <= bmi < 24:
who,nat = "normal","normal"
elif 24 <= bmi < 25:
who,nat = "normal","fat"
elif 25 <= bmi < 28:
who,nat = "fat","fat"
elif 28 <= bmi < 30:
who,nat = "fat","too fat"
else:
who,nat = "too fat","too fat"
print("the bmi level is: WHO {}, NAT {}".format(who,nat))
finally:
print("come on!!!")
网友评论