jeudi 9 janvier 2020

else syntax error in a simple if -else statement in python

Below is returning syntax error for the else: statement. what am I doing wrong? when I use > on the if statement and remove the else: statement, it did execute the code by drawing the square. '''

if elephant_weight < ant_weight:
square()
else:
qazi_turtle.forward(200)

''' it gives the following error statement: File "", line 3 else: ^ SyntaxError: invalid syntax

Aucun commentaire:

Enregistrer un commentaire