Answer: Turtle Challenge #162

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

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

The answers

What does the picture show? A sun! A gold circle with orange rays all round it.

How many rays will it have? 12 rays. t.setheading(ray * 30) points the turtle in a new direction for each ray.

Do the rays touch the circle? No. The turtle moves out 75 steps with the pen up first, which is a little further than the circle’s radius of 60, so there’s a gap.

How the code works

begin_fill() and end_fill() colour in the circle. Then each ray starts from the middle: the turtle jumps out past the edge with its pen up, then draws.

import turtle

t = turtle.Turtle()
t.speed(0)
t.pensize(4)
t.pencolor("orange")
t.fillcolor("gold")

t.penup()
t.goto(0, -60)
t.pendown()
t.begin_fill()
t.circle(60)
t.end_fill()

for ray in range(12):
    t.penup()
    t.goto(0, 0)
    t.setheading(ray * 30)
    t.forward(75)
    t.pendown()
    t.forward(60)

t.hideturtle()
turtle.done()

Try it: Can you add a smiley face to the sun?