Discuss / Python / 是不是哪里能够缩短一些

是不是哪里能够缩短一些

Topic source

张小顺的

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

height = input('height:') weight = input('weight:') a = float(height) b = float(weight) BMI = b / (a * a) if BMI < 18.5: print ('too light {0:.1f}'.format(BMI)) elif BMI >= 18.5 and BMI < 25: print ('normal {0:.1f}' .format(BMI)) elif BMI >= 25 and BMI < 28: print ('fat {0:.1f}' .format(BMI)) elif BMI >= 28 and BMI < 32: print ('very fat {0:.1f}'.format(BMI) ) elif BMI >= 32 : print ('sincere fat{0:.1f}'.format(BMI))


  • 1

Reply