0
Syntax Error
copy of my python program bt. else statement is no output. x=4 if x==5: print ("Yes") else: print ("No") output: syntax error
4 Answers
+ 3
x=4
if x==5:
print ("Yes")
else:
print ("No")
don't forget about spaces!
0
kkh
0
x=4
if x==5:
print ("Yes")
else:
print ("No")
output: syntax error
It is because you've indented the else statement wrongly. It should have the same indentation with the if statement. Like This;
x=4
if x==5:
print ("Yes")
else:
print ("No")
output: No
0
it is due to indentation when you write if related else at same level