0
Else is not working..... Python shows syntax error
10 Respuestas
+ 5
@indresh remove indentation from else. it's not the same block of code.
+ 5
yes, if you remove the indentation it should work. same for elif. Also, you may want to add some code after else to tell it what to do when it runs.
so, let's apply this to your example:
x = 4
if x == 5:
print("yes")
elif x == 3:
print("yep")
else:
print("no")
+ 1
could you share the code you used?
0
X=4
If x==5:
Print("yes")
Else:
After this when I press enter python shows syntax error
0
And elif also doesn't work
0
in first lune x should be smaller n e also should be smaller in else
0
X and x are different. Python is case sensitive.
0
indresh, Python is case sensitive. You defined X, not x
0
i got The same issue
- 1
Probably you're missing the colon at the end. But share your code with us.