0
Bmi calculator syntax error
I'm trying to make te bmi calculator work but I end up with getting the syntax error my code is as follows: weight= int(input()) height= float(input()) bmi= weight / height**2 if bmi < 18.5: print ('Underweight') elif 25>bmi>=18.5: print ('Normal') elif 30>bmi>=25: print ('Overweight') elif bmi>=30: print('Obesity') any help would be greatly appreciated.
3 Respostas
+ 3
Your indentation is not correct.
[FIX]
weight= int(input())
height= float(input())
bmi= weight / height**2
if bmi < 18.5:
print ('Underweight')
elif 25>bmi>=18.5:
print ('Normal')
elif 30>bmi>=25:
print ('Overweight')
elif bmi>=30:
print('Obesity')
+ 1
Mwsdo
See this:
#your code goes here
weight = int(input());
height = float(input());
bmi = weight/float(height*height);
if bmi<18.5:
print('Underweight')
elif bmi>=18.5 and bmi<25:
print("Normal")
elif bmi>=25 and bmi<30:
print('Overweight')
else:
print('Obesity')
0
you have done indentation error
this is the correct format:
weight= int(input())
height= float(input())
bmi= weight / height**2
if bmi < 18.5:
print ('Underweight')
elif 25>bmi>=18.5:
print ('Normal')
elif 30>bmi>=25:
print ('Overweight')
elif bmi>=30:
print('Obesity')