What did I do wrong here please? Iā€™m getting the right output but itā€™s still failing the tests | Sololearn: Learn to code for FREE!
+ 1

What did I do wrong here please? Iā€™m getting the right output but itā€™s still failing the tests

weight = int(input()) height = float(input()) BMI = weight/height**2 if BMI < 18.5: print("underweight") elif 18.5 <= BMI < 25: print("normal") elif 25 <= BMI < 30: print("overweight") else: print("obesity")

10th Jan 2022, 7:31 AM
Abdulmalik Dahiru Kona
6 Answers
+ 8
Use BMI = weight / (height/100)**2 Correct program is šŸ‘‡šŸ‘‡ weight = int(input()) height = float(input()) BMI = weight/(height/100)**2 if BMI < 18.5: print("underweight") elif 18.5 <= BMI < 25: print("normal") elif 25 <= BMI < 30: print("overweight") else: print("obesity") I hope this solve your problem.
10th Jan 2022, 7:50 AM
Vaibhav
Vaibhav - avatar
+ 1
Hope this helps weight = int(input()) height= float(input()) bmi = weight/float(height*height) if bmi < 18.5: print("Underweight") if bmi >= 18.5 and bmi < 25: print("Normal") if bmi >= 25 and bmi < 30: print ("Overweight") if bmi >= 30: print("Obesity")
10th Jan 2022, 8:09 AM
Romie
Romie - avatar
+ 1
It worked! NEZ Thank you
10th Jan 2022, 10:09 AM
Abdulmalik Dahiru Kona
+ 1
Romie it worked too
10th Jan 2022, 10:11 AM
Abdulmalik Dahiru Kona
+ 1
10th Jan 2022, 11:30 AM
Romie
Romie - avatar
0
Abdulmalik Dahiru Kona w = float(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") elif bmi >= 30: print("Obesity") #You have to output in the correct cases
10th Jan 2022, 8:01 AM
NEZ
NEZ - avatar