Guys why doesn't this BMI calculator program work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Guys why doesn't this BMI calculator program work?

Coding feels exciting for the first time haha. Butt im stuck there.. The app shows error everytime I try to calculate this. Can anyone help me out? It would mean alot. https://code.sololearn.com/csohBYR7y0sx/?ref=app

15th Mar 2021, 6:59 AM
Ne Obliviscaris2
Ne Obliviscaris2 - avatar
5 Answers
+ 2
Ne Obliviscaris2 Try this: #your code goes here weight = int(input()); height = float(input()); bmi = weight/float(height*height); 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')
16th Mar 2021, 1:17 AM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
15th Mar 2021, 7:00 AM
Tomas Konecny
0
Maybe try to delete that text from your input commands
15th Mar 2021, 7:02 AM
Tomas Konecny
0
I don't think I should change anything in the input because it's just displaying text and nothing more. I do not see that much of a difference in our respective codes. Except that I've used else and you've gone with elif. Else does seem vague whereas elif seems more specific here.
15th Mar 2021, 7:24 AM
Ne Obliviscaris2
Ne Obliviscaris2 - avatar
0
Tomáš Konečný thanks for your time, mate!
15th Mar 2021, 7:25 AM
Ne Obliviscaris2
Ne Obliviscaris2 - avatar