Discuss / Python / 疑问

疑问

Topic source

-- coding: utf-8 --

h=int(input('height:')) w=int(input('weight:')) print('h','w') BMI=w/h print('BMI')

if BMI<18.5: print('过轻') elif BMI<25: print('正常') elif BMI<28: print('过重') elif BMI<32: print('肥胖') else: print('严重肥胖')

两个小问题哈: 1、int只能输入整数,有没有什么可以输入小数的参数哈 2、为什么这里print出来的只是h、w、BMI,而不是具体的值哈?

黄河_y

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

1.float 2.加了引号


  • 1

Reply