Is there anything wrong with this BMI calculator? (SOLVED) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is there anything wrong with this BMI calculator? (SOLVED)

i'm a begginer and i've done the BMI Calculator project, i passed it but when i tried it somewhere else it didn't work. Can you please tell whats the problem with the code? weight = float(input()) height = float(input()) BMI = weight / (height ** 2) 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") Thanks

1st Sep 2021, 11:38 AM
Elijah
4 Answers
+ 3
Looks just fine to me, doesn't look like the compiler on Sololearn is user friendly, change your weight and height to actual values and try again
1st Sep 2021, 11:41 AM
Tim
Tim - avatar
+ 2
Elijah Sometimes when you copy / paste across different platforms, you get some weird results. Try writing the code directly into your 3rd party platform
1st Sep 2021, 12:08 PM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
Hi Elijah! If you tried this on Sololearn code playground, you have to provide both inputs at a same time on that alert box. Both inputs should be separated in a new line and hit the submit. For example, 60 1.80
1st Sep 2021, 12:23 PM
Python Learner
Python Learner - avatar
+ 2
Thank you all
1st Sep 2021, 1:59 PM
Elijah