Answer: Turtle Challenge #15

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

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

The answers

How many steps will the staircase have? 8 steps, one for each time round the loop.

Which way does the staircase climb? Up and to the right. The turtle starts facing right, goes along, turns left to go up, then turns right to face along again.

How the code works

Each time round the loop the turtle draws one step: along, up, then it turns back to face the same way as before.

import turtle

t = turtle.Turtle()
t.speed(0)
t.pensize(5)
t.pencolor("red")

for step in range(8):
    t.forward(40)
    t.left(90)
    t.forward(40)
    t.right(90)

t.hideturtle()
turtle.done()

Try it: Can you make the staircase go down instead of up?