rlfrick
rlfrick

Reputation: 41

Syntax error at the if/elif statement, not sure what's causing the error

I keep getting a syntax error at the if statement, and I'm not sure why I'm getting the error. Can anyone help?

def draw_square(self, loc, width):

    loc = (x, y)
    for i in range (3):
        width(width)
        turtle.forward(60)
        turtle.right(90)
        turtle.forward(random.randint(10,100))
        turtle.right(90)
        turtle.forward(60)
        turtle.right(90)
        turtle.forward(random.randint(10, 100))

    if turtle.xcor < or > x:
        x = turtle.xcor
    elif turtle.ycor < or > y:
        y = turtle.ycor

    return self.loc, self.width

Upvotes: 2

Views: 60

Answers (1)

Roberto Jaimes
Roberto Jaimes

Reputation: 105

In think your syntax is invalid in:

if turtle.xcor < or > x:
    x = turtle.xcor
elif turtle.ycor < or > y:
    y = turtle.ycor

Try to change it for:

if turtle.xcor < x or turtle.xcor > x:
    x = turtle.xcor
elif turtle.ycor < y or turtle.ycor > y:
    y = turtle.ycor

Upvotes: 1

Related Questions