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")

6th Aug 2021, 6:11 AM
Arshad Ali
Arshad Ali - avatar
6 Réponses
6th Aug 2021, 6:13 AM
Eashan Morajkar
Eashan Morajkar - avatar
+ 1
It's alright maybe you having problem with sololearns input system
6th Aug 2021, 6:37 AM
Abs Sh
Abs Sh - avatar
+ 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.
6th Aug 2021, 8:14 AM
Python Learner
Python Learner - avatar
+ 1
JUMP_LINK__&&__Python__&&__JUMP_LINK Learner , thanks. It worked. So basically, I was providing unwanted output through the prompt messages.
6th Aug 2021, 8:25 AM
Arshad Ali
Arshad Ali - avatar
0
The conditions might be wrong,but the code works fine
6th Aug 2021, 6:13 AM
Eashan Morajkar
Eashan Morajkar - avatar
0
I wrote this code for End of Module project (Python for beginner). It is not working as expected there, but working fine otherwise.
6th Aug 2021, 7:02 AM
Arshad Ali
Arshad Ali - avatar