+ 1

Why dont Working?

#your code goes here weight = int(input()) height = float(input()) height = int(height) formul = float(weight/(height**2)) if formul : formul<18.5 print("Underweight") elif formul : formul=18.5 and formul<25 print("Normal") elif formul : formul>=25 and formul<30 print("Overweight") elif formul : formul>=30 print("Obesity")

11th Aug 2022, 8:06 AM
Zulpakar
Zulpakar - avatar
7 odpowiedzi
+ 3
if formul<18.5: print("Underweight") do so with the other values
11th Aug 2022, 8:27 AM
Oma Falk
Oma Falk - avatar
+ 1
Have you already tried looking for examples via search? Use the search feature for BMI Calculator.
11th Aug 2022, 8:09 AM
Chris Coder
Chris Coder - avatar
+ 1
Thanks Jayakrishna🇮🇳 it woking 🙏👍
11th Aug 2022, 2:57 PM
Zulpakar
Zulpakar - avatar
+ 1
Why are you converting height to int, just let it be a float
13th Aug 2022, 7:05 AM
Suryanshu Mittal
Suryanshu Mittal - avatar
0
Yes I learn For BMI Chris Coder
11th Aug 2022, 9:26 AM
Zulpakar
Zulpakar - avatar
0
Oma Falk ouput other value .. ( Obesity) why ?
11th Aug 2022, 9:27 AM
Zulpakar
Zulpakar - avatar
0
Systax for if statement is like: if condition : #if code elif condition : # elif code So as per @Oma Falk, it should like if formul < 18.5 : print( "Underweight") elif formul<25 : .. .. This is for single case, do the same for other cases.. if formul : #always true, except for 0 value #formul>=18.5 and formul<25 is a condition, has no effect. Write it as condition for if block condition. Height should be in float value so dont convert to int. Hope it helps..
11th Aug 2022, 2:44 PM
Jayakrishna 🇮🇳