Discuss / Python / 求大神帮简化

求大神帮简化

Topic source

须戒sue

#1 Created at ... [Delete] [Delete and Lock User]
def body_bmi(height,weight):    y=float(height)    x=float(weight)    bmi=(x/(y**2))    if bmi<=18.5:        print('你的BMI为%.2s属于过轻'%bmi)    elif 18.5<bmi<=25:        print('你的BMI为%.2s属于正常'%bmi)    elif 25<bmi<=28:        print('你的BMI为%.2s属于过重'%bmi)    elif 28 < bmi <= 32:        print('你的BMI为%.2s属于肥胖'%bmi)    elif 32 < bmi:        print('你的BMI为%.2s属于过度肥胖'%bmi)    else:        print('没救了')body_bmi(input('please input height:'),input('please input weight:'))

  • 1

Reply