Discuss / Python / answer

answer

Topic source
h=input("please enter your height(m):")
W=input("please enter your weight(kg):")
h=float(h)
W=float(W)
bmi=W/(h**2)#表示h的平方if bmi>32:#注意冒号的使用,使用正确下面会自动格式对准:缩进4个字符    print('严重肥胖')
elif bmi>=28:
    print('肥胖')
elif bmi>=25:
    print('过重')
elif bmi>=18.5:
   print("正常")
else:
    print('过轻')

  • 1

Reply