+ 1

Can anyone tell me about unexpected indent error in phython?

#your code goes here w = int(input()) h = float(input()) bmi = w//(h*h) if bmi<18.5: print("under weight") elif bmi>25 and bmi<30: print("overweight") elif bmi>18.5 and bmi<25: print("normal") elif bmi>30: print("obesity")

21st Jul 2021, 9:36 AM
Shivankit Agarwal
Shivankit Agarwal - avatar
5 odpowiedzi
+ 4
One of your indent levels don't match the others, at a glance I think it is under if bmi < 18.5: But I haven't checked your code. I think the error will give you the line of code where the error occurs for you to find. Good luck
21st Jul 2021, 9:44 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
We don't see any error in your code. If it's a sololearn project, your output should be matched with expected output. Underweight, Overweight...
21st Jul 2021, 11:19 AM
Simba
Simba - avatar
+ 1
bmi = w/(h*h) not //
21st Jul 2021, 10:43 AM
Angela
Angela - avatar
+ 1
Simba it already matched but....☹️
21st Jul 2021, 11:26 AM
Shivankit Agarwal
Shivankit Agarwal - avatar
+ 1
#try this #your code goes here w = int(input()) h = float(input()) bmi = w//(h*h) if bmi<18.5: print("Underweight") elif bmi>25 and bmi<30: print("Overweight") elif bmi>18.5 and bmi<25: print("Normal") elif bmi>30: print("Obesity")
21st Jul 2021, 11:44 AM
Simba
Simba - avatar