+ 1

Why Has It Happened Like This - Python BMI Calculator

In Sololearn you sometimes have exams at the end of a topic and this exam was to create a BMI Calculator This is my code x = int(input())/(float(input())**2) if x < 18.5: print ('Underweight') if x >= 18.5 and x < 25: print ('Normal') if x >= 30: print ('Obesity') *It tells us to put weight as int *It tells us to put height as a float As we know test cases after Test Case 2 are hidden if you are not a subscribed member. All of my test cases (1,2,4,5,) were successful but somehow test case 3 is not successful and I cannot see because it's hidden which is a shame because it tells me I have not finished this test. ***Edit: Question has been solved thank you @Cyan The final code is: x = int(input())/(float(input())**2) if x < 18.5: print ('Underweight') if x >= 18.5 and x < 25: print ('Normal') if x >= 25 and x < 30: print ('Overweight') if x >= 30: print ('Obesity')

13th Feb 2021, 7:11 AM
George Tapatas
2 ответов
+ 5
You are missing a condition for "Overweight".
13th Feb 2021, 7:16 AM
noteve
noteve - avatar
+ 1
i say don't consider anything in int..... read everything in float...
13th Feb 2021, 7:18 AM
NaSaPaKri
NaSaPaKri - avatar