height=input(r'please enter the height(m):')
weight=input(r'please enter the weight(kg):')
a=0
try:
a=float(weight)/(float(height)**2)
except ValueError:
height=input(r'please enter your formal height(m):')
weight=input(r'please enter your formal weight(kg):')
if a<18.5:
print('BMI:%.2f ! you are too light'%a,end='\t')
elif 18.5<=a<25:
print('BMI:%.2f ! you are nomal '%a,end='\t')
elif 25<=a<28:
print('BMI:%.2f ! you are overweight'%a,end='\t')
elif 28<=a<32:
print('BMI:%.2f ! you are fat'%a,end='\t')
else :
print('BMI:%.2f ! you are severe obesity'%a,end='\t')
Sign in to make a reply
用户7424820678
height=input(r'please enter the height(m):')
weight=input(r'please enter the weight(kg):')
a=0
try:
a=float(weight)/(float(height)**2)
except ValueError:
height=input(r'please enter your formal height(m):')
weight=input(r'please enter your formal weight(kg):')
a=float(weight)/(float(height)**2)
if a<18.5:
print('BMI:%.2f ! you are too light'%a,end='\t')
elif 18.5<=a<25:
print('BMI:%.2f ! you are nomal '%a,end='\t')
elif 25<=a<28:
print('BMI:%.2f ! you are overweight'%a,end='\t')
elif 28<=a<32:
print('BMI:%.2f ! you are fat'%a,end='\t')
else :
print('BMI:%.2f ! you are severe obesity'%a,end='\t')