Discuss / Python / 练习

练习

Topic source

vvvhyx

#1 Created at ... [Delete] [Delete and Lock User]
height = input('Please enter your height(m):')
weight = input('Please enter your weight(kg):')
bmi = float(weight) / float(height)**2
bmi = float('%.1f' % bmi)
if bmi >= 32:
    print('你的BMI:', bmi, '\n高于32:严重肥胖')
elif bmi >= 28 :
    print('你的BMI:', bmi, '\n28-32:肥胖')
elif bmi >= 25:
    print('你的BMI:', bmi, '\n25-28:过重')
elif bmi >= 18.5:
    print('你的BMI:', bmi, '\n18.5-25:正常')
else:
    print('你的BMI:', bmi, '\n低于18.5:过轻')

  • 1

Reply