- 3

BMS CALCULATOR IS WRONG.

x=float(input("Enter Your Weight")) y=float(input("Enter Your Height")) z=(x/(y**2)) if z<18.5: print("undernoursihed") elif 18.5<=z<25: print("Normal") elif 25<=z<30: print("Overwieght") else: print("obesity") THIS CODE SHOWING WRONG OUTPUT

8th May 2021, 10:34 AM
Silent Pearls
Silent Pearls - avatar
10 Respuestas
+ 3
Silent Pearls , you also wrote wrong "Overweight". Change it. Also when you check for multiple conditions in if and elif clauses use "and" to join them.
8th May 2021, 10:52 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 2
"undernoursihed" (what kind of typo is it?) => "Underweight", "Overwieght" => "Overweight", "obesity" => "Obesity". Also, it is BMI, not BMS.
8th May 2021, 11:55 AM
#0009e7 [get]
#0009e7 [get] - avatar
+ 1
in python, too, such a record of comparing values is acceptable
8th May 2021, 11:12 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Yes, but if the record is much longer, it makes it hard to read and debug. I think it's more clear to do it with "and" logical operator.
8th May 2021, 11:18 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
Agree, but on the other hand it is easy to get confused between "and" and "or"
8th May 2021, 11:21 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
It all depends on your knowledge. You can make easy mistakes, because your lack of knowledge. Other thing to mention is that many programming languages such as: Java, C#, PHP etc. don't accept such a record without logical operators between the conditions.
8th May 2021, 11:29 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
Hi! Type all answers in first uppercase letter, delete string message from input
8th May 2021, 10:43 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
your goal is to pass five tests in the task?
8th May 2021, 10:47 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
- 2
I think no
8th May 2021, 10:46 AM
Silent Pearls
Silent Pearls - avatar
- 4
Send me the answer of 28 CODE PROJECT OF PYTHON FOR BEGINNERS COURSE ON SOLOLEARN..
8th May 2021, 11:17 AM
Silent Pearls
Silent Pearls - avatar