What is wrong in this code? Please point out. BMI calculator python. | Sololearn: Learn to code for FREE!

0

What is wrong in this code? Please point out. BMI calculator python.

w = float(input("Enter Weight ")) h = float(input("Enter Height ")) b = w / h**2 if b < 18.5: print("Underweight") elif (b >= 18.5 and b < 25.0): print("Normal") elif (b >= 25 and b < 30): print("Overweight") else: print("Obesity")

8/6/2021 6:11:26 AM

Arshad Ali

6 Answers

New Answer

+1

https://code.sololearn.com/chV1YaLvOQ45/?ref=app

+1

It's alright maybe you having problem with sololearns input system

+1

Hi Arshad! Generally, we're supposed to print output as same as expected by developers in coding practices. For example, you can't print 'hello world' if they required to print only 'hello'. The main reason is that python is a case sensitive programming language. So, it can differentiate both outputs easily. Likewise, prompt messages aren't accepted in Sololearn practices since they're not in expected output. So, you can remove your prompt messages inside input() and check it again.

+1

Python Learner , thanks. It worked. So basically, I was providing unwanted output through the prompt messages.

0

The conditions might be wrong,but the code works fine

0

I wrote this code for End of Module project (Python for beginner). It is not working as expected there, but working fine otherwise.