Untitled

 avatar
unknown
plain_text
a year ago
550 B
4
Indexable
import turtle

# Create a turtle screen
screen = turtle.Screen()
screen.bgcolor("white")

# Create a turtle object
my_turtle = turtle.Turtle()
my_turtle.shape("turtle")
my_turtle.color("blue")

# Function to draw a square
def draw_square():
    for _ in range(4):
        my_turtle.forward(100)
        my_turtle.left(90)

# Animate the square
for _ in range(36):  # Repeat the square drawing 36 times
    draw_square()
    my_turtle.right(10)  # Rotate the turtle by 10 degrees

# Close the turtle graphics window when clicked
screen.exitonclick()

Editor is loading...
Leave a Comment