Discuss / Python / 2020-3-17if学习

2020-3-17if学习

Topic source

Xxiangq

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

height = float(input('please enter your height:(m)'))

weight = float(input('please enter your weight:(kg)'))

bmi = weight/(height*height)

if bmi < 18.5:

    print('hello your is bmi:%.2f ,bmi过轻'%(bmi))

elif bmi <= 25:

    print('hello your is bmi:%.2f ,bmi正常'%(bmi))

elif bmi <= 28:

    print('hello your is bmi:%.2f ,bmi过重'%(bmi))

elif bmi <= 32:

    print('hello your is bmi:%.2f ,bmi肥胖'%(bmi))

elif bmi > 32:

    print('hello your is bmi:%.2f ,bmi'%(bmi))

print('your height is:%.2fm\nweight is:%.1fkg\nbmi is:%.1fbmi'%(height,weight,bmi))


  • 1

Reply