Discuss / Python / Day-4打卡。交作业3

Day-4打卡。交作业3

Topic source

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 .


  • 1

Reply