Why if condition not working?? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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