Need help with this assignment for college
def draw_square(square_turtle, x, y, side_length):
# Position the turtle
square_turtle.penup()
square_turtle.setposition(x, y)
square_turtle.pendown()
# Make the square
for side in range(4):
square_turtle.forward(side_length)
square_turtle.left(90)
def draw_wall(wall_turtle, x, y, height):
for square in range(5):
draw_square(wall_turtle,x ,y,height)
wall_turtle.penup()
wall_turtle.forward(20 + height)
draw_wall(drawing_turtle, 2, 20, 10)
drawing_turtle = Turtle()
This assignment calls for me to draw 5 square walls with gaps in between them
btw this is using import turtle*
I have to use the draw_square function that was provided to me with a loop to draw each square
My problem is that I cannot draw the gap because each time the draw_square function is called the x and y position is reset so it keeps just drawing a square over itself 5 times
Any help is welcome
Thanks :)