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)
Sign in to make a reply
曹V曹
-- 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)