Learn Python by drawing with a turtle.
Each lesson works two ways. Students can work through the online tutorial at their own pace (it checks their answers and saves their progress in their browser), or you can teach it to the whole class from the slides, then send students into the tutorial for the Modify and Make steps.
Every lesson guide has plain-language notes, the answers to every check, a solution for every task, and slides and a worksheet for Waypoints Prepare. These guide pages are not linked from student pages, but they are not secret either: keep printed Teacher editions for answers you do not want students to find.
Whole-course cheat sheet: Open to print (every command, grouped by unit: a handout for the final challenge)
Commands, loops, names, the counter and updates, one idea at a time.
A program is a list of instructions the computer follows in order, top to bottom. forward(100) moves the turtle 100 steps; right(90) turns it a quarter turn.
A loop repeats the lines indented under it: for i in range(4): means "do these lines 4 times". A variable is a name for a value: sides = 5 stores 5 under the name sides, and the program uses 5 wherever it sees sides.
sides once and every line that uses it follows. They can also hold calculations: angle = 360 / sides works out the turn for you.A loop is a recipe step that says "stir 4 times". A variable is a labelled jar: the label stays, the contents can change.
Where it breaks: in maths, x = x + 5 is impossible. In Python = means store, read right to left: work out x + 5, then put the answer back in x. Say "store" aloud instead of "equals" and students follow.
forward(100) then right(90), four times.for i in range(4): and the two lines indented under it. Same square.sides = 6 at the top, use range(sides) and right(360 / sides). Change sides to 3, then 12.size = size + 5 break?" It works out the right side first, then stores the result back in size.Loops and variables appear in every later lesson. Next unit adds choices (if) and lists; later, functions give a group of steps a name.
Cheat sheet: Open to print (A4, with a picture of what each command draws) · Markdown
Decisions, patterns, lists and for-each, then a challenge: make a tile.
A decision lets the program choose. if score > 10: asks a question; the indented lines under it run only when the answer is yes, and the lines under else: run when it is no. elif asks another question when the first answer was no.
A list keeps many values in order under one name: colours = ["red", "blue", "green"]. for c in colours: takes them one at a time. Each item has a place, counted from 0: colours[0] is the first.
An if is a fork in a path with a sign: "if it is raining, take the left path". A list is a numbered row of lockers.
Where it breaks: the lockers start at number 0, not 1. A list of 5 items has places 0 to 4, and asking for place 5 is an error. Expect this surprise; it is the most common list bug.
print(7 % 2) and print(8 % 2). % is the remainder after dividing (not percent): 1 for odd numbers, 0 for even.for i in range(6): with if i % 2 == 0: print("even") and else: print("odd") under it.colours = ["red", "blue", "green"] and print(colours[1]). It prints blue.= stores a value. Two == ask whether two things are equal.Decisions are the hit test in Build a button and the rules in the final game. Lists hold the game's path and the buttons on a control panel.
Cheat sheet: Open to print (A4, with a picture of what each command draws) · Markdown
Self-paced briefs students can pick up after the lesson named on each. Students tick their own milestones and claim a badge; the page lights the skills their code uses. Badges stay in the student's browser: ask them to press Show your teacher. Open the projects page
Make a pattern that changes as it goes: stripes, a checkerboard, a row of tiles that swap colour, or a spiral that switches every third turn. The rule for what changes is yours.
Milestones:
A first open brief: everything it needs is in lessons 1 to 3. Students who stall usually have no rule yet: ask them to say the rule aloud ("every second square is red") before they code it.
from turtle import *
speed(0)
penup()
goto(-200, 0)
size = 20
for i in range(12):
if i % 3 == 0:
fillcolor("gold")
elif i % 3 == 1:
fillcolor("tomato")
else:
fillcolor("teal")
pendown()
begin_fill()
for side in range(4):
forward(size)
left(90)
end_fill()
penup()
forward(size + 6)
size = size + 2