Discuss / Python / 作业input

作业input

Topic source

曹V曹

#1 Created at ... [Delete] [Delete and Lock User]

-- coding: utf-8 --

Height = input('Height:') Weight = input('Weight:') Height = float(Height) Weight = float(Weight) s = Weight/(Height**2)

if s < 18.5: print("BMI指数为:%.2f ,过轻" %s) elif 18.5<= s <=25: print("BMI指数为:%.2f,正常" %s) elif 25 < s <28: print("BMI指数为:%.2f,过重" %s) elif 28 <= s <= 32: print("BMI指数为:%.2f,肥胖" %s) else: print("BMI指数为:%.2f,严重肥胖" %s)


  • 1

Reply