0

Please explain the error

BMI calculator error https://code.sololearn.com/c63K4TUE819w/?ref=app

30th Apr 2021, 11:11 AM
vijay thakur
vijay thakur - avatar
4 Respostas
+ 4
it has several errors but the first error is indentation error which means inside the scope you did'nt put enough spaces what do i mean is something like that: this is your code if z<18.5: print("you are bad") elif z>22.5: print("you are overwight") elif z<=22.5 and z>=18.5: print("you are fit") and this is your code with true indentation x=float(input()) s=float(input()) z= x/(s*s) print("your BMI is",z) if z<18.5: print("you are bad") elif z>22.5: print("you are overwight") elif z<=22.5 and z>=18.5: print("you are fit")
30th Apr 2021, 11:23 AM
Nima
+ 3
Please review the importance of indentation within Python. IE if num >18: print("Adult") else: print("Child")
30th Apr 2021, 11:24 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
Thanks guys
30th Apr 2021, 12:06 PM
vijay thakur
vijay thakur - avatar
+ 2
vijay thakur Try 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')
30th Apr 2021, 10:03 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar