Grades 1–8 Math · 8 worksheets · more than 62,000 different sheets

Coding Worksheets

Code is a list of steps for a computer to follow, one at a time and in order. On these sheets the computer is a pencil on a grid: start on the arrow, facing the way it points, and follow each line of code. "Move forward 2." moves two squares; a turn changes the way you face, not the square you are on.

Reviewed by Mrs. Jennifer Mitchell, Teacher, Ms. Olivia Parker, Teacher, Mrs. Catherine Reynolds, Teacher, Mr. Daniel Carter, Teacher and Mr. Robert Harrison, Teacher. How we check worksheets

ForGrade 1Grade 2Grade 3Grade 4Grade 5Grade 6Grade 7Grade 8

About these worksheets

Each sheet has three pages. First, run the code to find the letter where it stops. Then, find the one wrong line in a code and write the right step. Last, write your own code to reach a letter. The levels add one idea at a time, as in the Ontario code strand: two robots whose codes run at the same time (concurrent events), a repeat (loop), a repeat inside a repeat, an if statement that runs only on a star, and a subprogram with a name. Every answer is worked out by computer from the code, and the answer key draws the path.

In Grade 8 the code is short Python that analyzes a week of data: the mean, the best day, the days to reach a goal, or a decision such as whether to bake more. Run it line by line, change a line and run it again, write a missing line, and compare two codes that print the same to see which one does less work. Each program was run to make the answer key, so it prints exactly what Python prints.

How the levels work

  1. Steps in order

    Short code with moves and turns, such as Turn right. For Grades 1 and 2.

  2. Two robots at once

    Two codes that run together, one line each on every beat: where is each robot, and when do they meet? For Grades 2 and 3.

  3. Repeats

    Code with loops such as Repeat 3 times. For Grade 3.

  4. Nested repeats

    A repeat inside a repeat. For Grade 4.

  5. If statements

    Repeats with If you are on a star. For Grades 5 and 6.

  6. Subprograms

    A named subprogram, such as Zigzag, called in the code. For Grade 7.

  7. Coding with data: run and change the code

    Six Python programs over a week of data: what each prints, what a changed line prints, and how often a line runs. For Grade 8.

  8. Coding with data: write and improve the code

    Write the missing line of three programs, then compare two codes that print the same by how often they go round their loops. For Grade 8.

Tips

  • Point to each line as you run it, and keep a finger on the square you are on.
  • Turn the paper, or turn yourself, to check which way is right after a turn.
  • For a repeat, count each time round: do all the steps under it, then start again at the top.
  • Run your own code on the grid before you call it done. If it misses the letter, find the line that goes wrong.
  • For Python, keep a table of each name and its value, and cross out the old value each time a line changes it. / always gives a decimal, so 8 / 2 prints 4.0.