<filename>main.py
import turtle as t
import random

tim = t.Turtle()
tim.shape("classic")
t.colormode(255)


def random_color():
    r = random.randint(0, 255)
    g = random.randint(0, 255)
    b = random.randint(0, 255)
    colours = (r, g, b)
    return colours


# for _ in range(15):
#     tim.forward(10)
#     tim.penup()
#     tim.forward(10)
#     tim.pendown()


# directions = [0, 90, 180, 270]
# tim.pensize(10)
tim.speed("fastest")


def draw_spirograph(size_of_gap):
    for _ in range(int(360 / size_of_gap)):
        tim.color(random_color())
        tim.circle(100)
        tim.setheading(tim.heading() + size_of_gap)


draw_spirograph(1)
# def draw_shape(num_sides):
#     angle = 360 / num_sides
#     for _ in range(num_sides):
#         tim.forward(100)
#         tim.right(angle)
#
#
# for shape_side in range(3, 11):
#     tim.color(random.choice(colours))
#     draw_shape(shape_side)

# for _ in range(200):
#     tim.color(random_color())
#     tim.forward(30)
#     tim.setheading(random.choice(directions))


screen = t.Screen()
screen.exitonclick()

<filename>main.py
import turtle as t
import random

tim = t.Turtle()
tim.shape("classic")
t.colormode(255)


def random_color():
    r = random.randint(0, 255)
    g = random.randint(0, 255)
    b = random.randint(0, 255)
    colours = (r, g, b)
    return colours


# for _ in range(15):
#     tim.forward(10)
#     tim.penup()
#     tim.forward(10)
#     tim.pendown()


# directions = [0, 90, 180, 270]
# tim.pensize(10)
tim.speed("fastest")


def draw_spirograph(size_of_gap):
    for _ in range(int(360 / size_of_gap)):
        tim.color(random_color())
        tim.circle(100)
        tim.setheading(tim.heading() + size_of_gap)


draw_spirograph(1)
# def draw_shape(num_sides):
#     angle = 360 / num_sides
#     for _ in range(num_sides):
#         tim.forward(100)
#         tim.right(angle)
#
#
# for shape_side in range(3, 11):
#     tim.color(random.choice(colours))
#     draw_shape(shape_side)

# for _ in range(200):
#     tim.color(random_color())
#     tim.forward(30)
#     tim.setheading(random.choice(directions))


screen = t.Screen()
screen.exitonclick()

# for _ in range(15): #     tim.forward(10) #     tim.penup() #     tim.forward(10) #     tim.pendown() # directions = [0, 90, 180, 270] # tim.pensize(10) # def draw_shape(num_sides): #     angle = 360 / num_sides #     for _ in range(num_sides): #         tim.forward(100) #         tim.right(angle) # # # for shape_side in range(3, 11): #     tim.color(random.choice(colours)) #     draw_shape(shape_side) # for _ in range(200): #     tim.color(random_color()) #     tim.forward(30) #     tim.setheading(random.choice(directions))