Discuss / Python / exercise(条件判断)练习

exercise(条件判断)练习

Topic source

叫我_小军

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

print('个人BMI指数计算') high = float(input('请输入身高(单位:m):')) weight = float(input('请输入体重(单位:kg):')) BMI = weight/(high**2) print('个人BIM指数:',BMI) if BMI > 32 : print('属于:严重肥胖') elif 28 < BMI <= 32 : print('属于:肥胖') elif 25 < BMI <= 28 : print('属于:过重') elif 18.5 < BMI <= 25: print('属于:正常') else : print('属于:过轻')

--------输出结果:-------- 个人BMI指数计算 请输入身高(单位:m):1.75 请输入体重(单位:kg):80.5 个人BIM指数: 26.285714285714285 属于:过重


  • 1

Reply