Answer: Turtle Challenge #316

Here’s what the code from Turtle Challenge #316 draws. This picture was made by running the code for real.

The drawing made by turtle challenge 316.
What the turtle drew.

The answers

What shape does the shape function draw? A hexagon (6 sides, turning 60 degrees each time).

How many of those shapes will you see? 36 of them, spun around the middle.

How many lines does the turtle draw altogether? 36 × 6 = 216 lines.

How the code works

The function shape is a new word we taught Python. The main loop uses it 36 times, turning 10 degrees in between, so the hexagons spin round in a ring.

import turtle

t = turtle.Turtle()
t.speed(0)
colours = ["orange", "forestgreen"]

def shape(size):
    for side in range(6):
        t.forward(size)
        t.left(60)

for i in range(36):
    t.pencolor(colours[i % 2])
    shape(100)
    t.left(10)

t.hideturtle()
turtle.done()

Try it: Change shape(100) to shape(i * 5). What happens?