Discuss / Python / 慢慢写

慢慢写

Topic source
  1 #!/usr/bin/env python3
  2 # -*- coding: utf-8 -*-
  3 '''
  4 小明身高1.75,体重80.5kg。请根据BMI公式(体重除以身高的平方)帮小明计算他的BMI指数,并根据BMI指数:
  5 低于18.5:过轻
  6 18.5-25:正常
  7 25-28:过重
  8 28-32:肥胖
  9 高于32:严重肥胖
 10 '''
 11 
 12 height = input('Please input your height: ')
 13 weight = input('Please input your weight: ')
 14 BMI = weight/height**2
 15 
 16 if BMI < 18.5:
 17     print ('Your weight is to qing.')
 18 elif ....

  • 1

Reply