#小明身高1.75,体重80.5kg。请根据BMI公式(体重除以身高的平方)帮小明计算他的BMI指数,并根据BMI指数:#低于18.5:过轻#18.5-25:正常#25-28:过重#28-32:肥胖#高于32:严重肥胖#用if-elif判断并打印结果height = float(input('Please type in your real height (m)\n'))weight = float(input('Please type in your real weight (kg)\n'))BMI = weight/(height*height)if BMI < 18.5: print('You are too much light!\n') print('Your BMI is %.1f .\n' % BMI)elif BMI>=18.5 and BMI<25 : print('Your body is very good,please keep health!\n') print('Your BMI is %.1f .\n' % BMI)elif BMI>=25 and BMI<28: print('You are a little fat!\n') print('Your BMI is %.1f .\n' % BMI)elif BMI>=28 and BMI<32: print('I am sorry that you are too fat!\n') print('Your BMI is %.1f .\n' % BMI)else: print('Oh god! You are so much heavy!! If you want to be good you need to keep health!\n') print('Your BMI is %.1f .\n' % BMI)
猫猫守卫者
结果:
Please type in your real height (m)
1.75
Please type in your real weight (kg)
80.5
You are a little fat!
Your BMI is 26.3 .