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.

27th Apr 2021, 5:11 AM
Mwsdo
Mwsdo - avatar
3 Antworten
+ 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')
27th Apr 2021, 5:14 AM
minirkk
minirkk - avatar
+ 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')
27th Apr 2021, 10:27 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
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')
27th Apr 2021, 7:14 AM
Manthan Santara
Manthan Santara - avatar