0
Please explain the error
BMI calculator error https://code.sololearn.com/c63K4TUE819w/?ref=app
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")
+ 3
Please review the importance of indentation within Python.
IE
if num >18:
print("Adult")
else:
print("Child")
+ 2
Thanks guys
+ 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')