Phyton BMI Calculator Test Case 3 incorrect | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Phyton BMI Calculator Test Case 3 incorrect

My code is: weight = int(input()) height = float(input()) BMI = weight/height**2 if BMI < 18.5: print('Underweight') elif (BMI >= 18.5) and (BMI < 30): print("Normal") elif (BMI >= 25) and (BMI < 30): print('Overweight') else: print('Obesity') My question is why is test case 3 wrong? Even though I used someone's code which is VERY-SIMILAR to mine. This is the code from someone I copied: w = int(input()) h = float(input()) bmi = w / h**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")

9th Jun 2022, 12:09 PM
Scythe09
Scythe09 - avatar
3 Answers
+ 3
It's clearly showing your condition for "Normal" Condition is different than others.. ! Check again clearly.. edit: bmi < 25 . but yours bmi < 30
9th Jun 2022, 12:31 PM
Jayakrishna 🇮🇳
0
weight = float(input('')) height = 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')
12th Jun 2022, 3:31 AM
Nícolas Nascimento
Nícolas Nascimento - avatar
0
Thanks for the explanation @jaya! Btw how long have you been in sololearn to learn all that languages?
22nd Jun 2022, 9:24 AM
Scythe09
Scythe09 - avatar