+ 3
please what is wrong with this code?. I dont understand
height=float(input()) weight=float(input()) BMI=(weight/(height**2)) if BMI<18.5: print ("underweight") elif BMI>=18.5 and BMI<25: print ("normal") elif BMI>=25 and BMI<30: print ("overweight") else BMI>=30: print ("obesity") print(BMI)
43 Answers
+ 12
Else statements shouldn't be written with any condition.
+ 7
The final correction is to match capitalization with the output that is shown in the task. Code Coach is case-sensitive.
+ 5
height = float(input())
weight = float(input())
BMI = (weight / (height ** 2))
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")
print(BMI)
+ 2
Please show the latest code.
+ 2
Glory please do not post off topic. You may start a new question for help with a different problem.
+ 2
I think the mistake is in putting a condition to else
+ 1
Inputs are in wrong order.
+ 1
how
+ 1
Code Coach provides weight first, then height. See the example provided in the task description.
+ 1
ok tenx
the code works
but its still not correct
+ 1
ok
corrected
but its still not correct
+ 1
You're right that it should only print the text. I overlooked the last line that prints BMI. Remove that line.
+ 1
thank you so much
+ 1
You're welcome! 🤝
+ 1
We cannot write condition with else,
You should use elif at the place of else or simply use else without condition 👍
+ 1
Me quedé en el mismo ejercicio 😁
+ 1
Input are improper arrange
+ 1
this one passes all 5 cases
weight = int(input())
height = float(input())
BMI = weight/(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")
elif BMI >= 30:
print("Obesity")
0
my output is both the string and the float
0
its suppose to be just de string