Discuss / Python / 交作业

交作业

Topic source

Tz

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

h=height=float(input('请输入身高(m):'))

w=weight=float(input('请输入体重(kg):'))

BMI=w/(h*2)

if BMI<18.5:

    print('BMI为:',BMI,'过轻')

elif 18.5<BMI<25.0:

    print('BMI为:',BMI,'正常')

elif 25.0<BMI<28.0:

    print('BMI为:',BMI,'过重')

elif 28.0<BMI<32.0:

    print('BMI为:',BMI,'肥胖')

elif BMI>32.0:

    print('BMI为:',BMI,'严重肥胖')

群青

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

(h*2)错了,是身高的平方,你这是身高乘2


  • 1

Reply