0

can anyone tell me what's wrong with my code?i am a beginner ,tried a lot but not able to find the bug

24th Apr 2021, 1:50 PM
Rajshree Mishra
Rajshree Mishra - avatar
6 odpowiedzi
+ 5
Be careful with your indentation. Use 4 spaces for each level of indent. Your if and elifs should line up. There is no "&&" in Python. Just use "and".
25th Apr 2021, 1:11 AM
David Ashton
David Ashton - avatar
+ 3
When asking for help, try to add as much information as possible to make it easier to understand the problem: what have you tried, whats the expected result, what are the errors you are getting, etc. From what I can see, I think there is an error with your if elif, they should all be aligned with the first if. I hope this helps
24th Apr 2021, 2:23 PM
Apollo-Roboto
Apollo-Roboto - avatar
+ 1
print('bmi code') height = float(input("enter your height in cm :")) weight = float(input("enter your weight in kg :")) bmi = float(weight / (height*height)) if bmi < 18.5: print("underweight") elif bmi>=18.5 && bmi<25: print ("normal") elif bmi>=25 && bmi<30: print ("overweight") elif bmi>=30: print ("obesity") else : print("error in your syntax")
24th Apr 2021, 1:53 PM
Rajshree Mishra
Rajshree Mishra - avatar
+ 1
thanks a lot sir i will try
25th Apr 2021, 9:26 AM
Rajshree Mishra
Rajshree Mishra - avatar
+ 1
thanks to all prblm solved
27th Apr 2021, 3:53 PM
Rajshree Mishra
Rajshree Mishra - avatar
0
Maintain proper indentation and use : after elif.
26th Apr 2021, 12:15 PM
Sidharth Kumar Padhi
Sidharth Kumar Padhi - avatar