BMI calculator - I am stuck, help needed | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

BMI calculator - I am stuck, help needed

I am learning Phyton now, so I need help from you guys, who has passed all the quizzes over there. I am stuck with BMI calculator. This code works on my laptop but not here. What is the problem, could you please help/tell me 🙏 Thanks in advance 🌸🌸🌸 weight = int(input("Enter your weight in kg: ")) height = float(input("Enter your height in meters: ")) x = weight/height**2 if x<18.5: print("Underweight") elif 18.5<=x<25: print("Normal") elif 25<=x<30: print("Overweight") elif x>=30: print("Obesity") print(x)

10th Feb 2022, 9:45 PM
Mia
Mia - avatar
4 Answers
+ 3
Mia I tested your code and noted that you are also outputting the value of x, which is not required. try deleting print(x)
10th Feb 2022, 11:01 PM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
Mia Sololearn server will be printing your prompt inputs. Remove the prompts & give a pure input should resolve your issue IE: weight = float(input()) height = float(input())
10th Feb 2022, 10:22 PM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
Unfortunately, this is not working as well 🤷 But thank you for your answer Rik Wittkopp 🙏
10th Feb 2022, 10:29 PM
Mia
Mia - avatar
+ 1
Rik Wittkopp yay 🎉 it worked. Thank sooooo much for your help 🤗 💜
10th Feb 2022, 11:35 PM
Mia
Mia - avatar