← RU Pythoncursus

Uitwerking: Turtlegraphics

import turtle

def zon(nr):
    for i in range(nr):
        turtle.forward(50)
        turtle.left(45)
        turtle.forward(10)
        turtle.left(90)
        turtle.forward(10)
        turtle.left(45)
        turtle.forward(50)
        turtle.right(180 - 360 // nr)

# main code

turtle.color('black', 'yellow')
turtle.speed(10000)
turtle.penup()
turtle.forward(-400)
turtle.pendown()
for i in range(1, 5):
    turtle.begin_fill()
    zon(3*i)
    turtle.end_fill()
    turtle.penup()
    turtle.forward(170)
    turtle.pendown()

turtle.done()