0
Python for beginners course bug?
I'm having troubles with project #26 the BMI calculator i think there maybe a bug or something I tried to write a code and after hour of it not working I googled it and it is the same as my code and it still doesn't work, last thing I did is copy/paste the Google code in case there is a hiding wrong thing I did but the result is the same as mine Which is the first test is correct and the rest are wrong.
9 Respostas
+ 4
No, you need to test if bmi < 18.5, not if bmi <= 18.499. And you need to apply the same logic to the other conditions as well
+ 4
You need to change it for EACH CONDITION of your code. Read the task description carefully
+ 3
Siluppose bmi was 18.45. It is < 18.5 and should be Underweight. However your current code would mark it as Normal.
+ 2
Can you please post your code, so we can see.
Maybe even code you copied from google is not good, to pass sololearn test.
+ 2
Ahmed Mahmoud after you have corrected the comparison thresholds, you must also corrected the inputs. Read carefully the input requirements. Weight comes first.
0
height = float(input())
weight = float(input())
bmi = weight/height**2
if bmi <= 18.4:
print("Underweight")
elif bmi <= 24.9:
print("Normal")
elif bmi <= 29.9:
print("Overweight")
else:
print("Obesity")
0
This is my code and the result return valid for the first test case which is Underweight only
For the second the expected is Obesity
But it shows me that my output is Underweight
So there is no spelling mistake or something like that it return different value
0
Lisa yes.
I edited my code but it didn't change anything still the first test case is True
And the rest are False
0
Lisa i did actually i made it .999 for evrey condition i can't post a picture here unfortunately, but the output of 2nd test case supposed to be Obesity but they say the output of my code outputted Underweight it can't be because of tiny difference like that