h = input('please input your height:(//cm)')
height = int(h) / 100
w = input('please input your weight:(//kg)')
weight = int(w)
bmi = weight/(height**2)
print(f'你的身高为{height}cm,你的体重为{weight}kg,BMI指数为{bmi:.2f}')
if bmi > 32:
print('严重肥胖')
elif bmi > 28:
print('肥胖')
elif bmi > 25:
print('过重')
elif bmi > 18.5:
print('正常')
else:
print('细狗TAT')
第一个print()内应该是{height}m
最好改成float
Sign in to make a reply
sober°_
h = input('please input your height:(//cm)')
height = int(h) / 100
w = input('please input your weight:(//kg)')
weight = int(w)
bmi = weight/(height**2)
print(f'你的身高为{height}cm,你的体重为{weight}kg,BMI指数为{bmi:.2f}')
if bmi > 32:
print('严重肥胖')
elif bmi > 28:
print('肥胖')
elif bmi > 25:
print('过重')
elif bmi > 18.5:
print('正常')
else:
print('细狗TAT')