+ 3

Why if condition not working??

age= int(input("enter your age")) if(age==18): print("you win") else: print("you lose") Output Indentation error : unexpected indent

19th Dec 2022, 4:07 PM
Berba Malek
Berba Malek - avatar
8 Réponses
+ 5
Berba Malek You should indent your code like this: if age == 18: print ('win') else: print ('lose')
19th Dec 2022, 4:22 PM
A͢J
A͢J - avatar
+ 2
Berba Malek Use TAB to give space because it takes 4 blank character at once.
21st Dec 2022, 3:57 AM
A͢J
A͢J - avatar
+ 1
Working Your code should be properly indent.
19th Dec 2022, 4:09 PM
A͢J
A͢J - avatar
+ 1
I did and not working
19th Dec 2022, 4:13 PM
Berba Malek
Berba Malek - avatar
+ 1
How much space should I leave?
19th Dec 2022, 6:19 PM
Berba Malek
Berba Malek - avatar
+ 1
Thanks
20th Dec 2022, 8:49 AM
Berba Malek
Berba Malek - avatar
+ 1
I just try it
20th Dec 2022, 8:51 AM
Berba Malek
Berba Malek - avatar
0
else: print("you lose") There should be an indent in the else block
21st Dec 2022, 1:24 PM
Levin Mwanganyi
Levin Mwanganyi - avatar