0

I want help for creating a BMI calculator in python beginners course.

The resulting number indicates one of the following categories: Underweight = less than 18.5 Normal = more or equal to 18.5 and less than 25 Overweight = more or equal to 25 and less than 30 Obesity = 30 or more https://code.sololearn.com/c0A9enu6t33O/?ref=app

26th May 2021, 3:18 AM
PokéBoi Yveltal
13 Answers
26th May 2021, 6:06 AM
Shobhit :)
Shobhit :) - avatar
+ 7
w=int(input()) h=float(input ()) bmi=(w/(h**2)) if bmi<18.5: print("Underweight") elif bmi>18.5: print ("Normal") elif bmi>25.0: print ("Overweight") elif bmi>30.0: print ("Obesity") i think its better❤
26th May 2021, 3:56 AM
aspad🇮🇷
aspad🇮🇷 - avatar
+ 6
You can use if instead of while ,its better And in line 11 you use while after break that while can not work
26th May 2021, 3:53 AM
aspad🇮🇷
aspad🇮🇷 - avatar
+ 4
No it's not right way While is a loop in python which has a no meaning here and yes indention effects a lot in python so keep that also in mind. You need to use if elif else logic with logical operators ie and
26th May 2021, 3:29 AM
Ayush Kumar
Ayush Kumar - avatar
+ 2
I AM S.P. Thank You So Much It works .... 🥰🥰
26th May 2021, 9:44 AM
PokéBoi Yveltal
+ 1
PokéBoi Yveltal if it worked than please mark my answer as correct. (Best answer) 😀😀
26th May 2021, 10:55 AM
Shobhit :)
Shobhit :) - avatar
+ 1
27th May 2021, 3:01 AM
PokéBoi Yveltal
0
amir it's not working sad
26th May 2021, 9:42 AM
PokéBoi Yveltal
27th May 2021, 3:04 AM
Shobhit :)
Shobhit :) - avatar
0
It's possible to solve it in three lines: https://code.sololearn.com/cu8NzXNr7Pk4/?ref=app
27th May 2021, 2:54 PM
Raffaele Bisogno
Raffaele Bisogno - avatar
0
Raffaele Bisogno You're right but sololearn code coach problems doesn't accepts more output than the expected output... it will be considered wrong but your code is absolutely correct.
27th May 2021, 3:40 PM
Shobhit :)
Shobhit :) - avatar
0
I AM S.P. , you can remove the text if you want.
28th May 2021, 10:23 AM
Raffaele Bisogno
Raffaele Bisogno - avatar
0
Raffaele Bisogno it's not the matter of the text, actually he's new to coding hence it's better for him to solve in simple way, you are pro hence you may understand and wrote it... just for his convenience!!
28th May 2021, 2:38 PM
Shobhit :)
Shobhit :) - avatar