Discuss / Python / XL-Task

XL-Task

Topic source
hei = input("Height(m):")
wei = input("Weight(kg):")
height = int(hei)
weight = int(wei)

BMI = weight / (height * height)

veryfat = u'严重肥胖'
fat = u'肥胖'
veryheight = u'过重'
normal = u'正常'
low = u'过轻'

if BMI > 32:
    print veryfat.encode('gbk')
elif (BMI > 28 and BMI <= 32):
    print fat.encode('gbk')
elif (BMI > 25 and BMI <= 28):
    print veryheight.encode('gbk')
elif (BMI > 18.5 and BMI <= 25):
    print normal.encode('gbk')
else:
    print low.encode('gbk')

  • 1

Reply