Skip to main content

Ontario coding curriculum · Grade 7

Grade 7 coding in the Ontario curriculum

What the Grade 7 math coding expectations ask for, what defined counts and sub-programs actually mean, and a free Scratch activity you can run in one period.

The two Grade 7 coding expectations

Coding sits in the Algebra strand of the Ontario Grades 1–8 Mathematics curriculum (2020), under overall expectation C3. In Grade 7, students are expected to:

C3.1 “solve problems and create computational representations of mathematical situations by writing and executing efficient code, including code that involves events influenced by a defined count and/or sub-program and other control structures”

C3.2 “read and alter existing code, including code that involves events influenced by a defined count and/or sub-program and other control structures, and describe how changes to the code affect the outcomes and the efficiency of the code”

Read the official Grade 7 C3 Coding page on Ontario.ca

In plain words: students write efficient code that uses counters and reusable sub-programs (C3.1). They also read someone else's code, change it, and explain what the change does to the result and to how efficient the code is (C3.2).

The key ideas, explained

A defined count

Code that runs a set number of times, or keeps track of how many times something has happened. In practice: a loop with a number, or a counter variable that goes up by one each time.

A sub-program

A named, reusable chunk of code, often called a function or procedure. In Scratch it's a custom block from “My Blocks”. Students write it once and use it many times, often with different inputs.

Efficient code

Code that gets the same result with fewer blocks or steps, and is easier to change. Students explain why one version is more efficient than another.

Other control structures

Loops and conditionals from earlier grades still count. Grade 7 combines them with counts and sub-programs.

The jump from Grade 6 is reuse. In Grade 6 students make code efficient. In Grade 7 they package it: build a sub-program once, give it inputs, and call it whenever it's needed. That's how real programmers work, and it's the idea behind functions in Python and every other language.

What a Grade 7 student should be able to do

  • Create a sub-program (custom block or function) with inputs and use it more than once
  • Use a counter variable to control how many times something happens
  • Rewrite long, repeated code as a sub-program, and explain why it's more efficient
  • Predict the output when an input value changes, then test the prediction
  • Read someone else's code, find the error and fix it (debugging is part of C3.2)

Where teachers get stuck

  • “Sub-program” is unfamiliar wording. It simply means a reusable chunk of code, such as a custom block or a function.
  • Inputs confuse students. Many can call a block but not see how the input value changes what happens inside it.
  • “Efficiency” is hard to assess. Give students a concrete measure, such as counting blocks or lines before and after.
  • Mixed experience in one class. Some Grade 7s have coded for years; others are starting from zero.

Free activity: the polygon factory

One period, 50 to 60 minutes. Covers C3.1 and C3.2. Works in Scratch (free, in the browser) with the Pen extension and My Blocks.

1. The long way (10 minutes)

Ask students to draw a triangle, a square and a hexagon, one after another, without loops. Then count the blocks.

move 60 steps
turn right 120 degrees
move 60 steps
turn right 120 degrees
move 60 steps
turn right 120 degrees
... (and so on for the square and hexagon)

It takes 26 move and turn blocks. Ask: “What if we needed 20 shapes?”

2. Build the sub-program (15 minutes)

In My Blocks, choose Make a Block, name it polygon, and add two number inputs: sides and length. Define it:

define polygon (sides) (length)
pen down
repeat (sides)
    move (length) steps
    turn right (360 / sides) degrees

The repeat (sides) loop is a defined count: it runs exactly as many times as the input says. The turn of 360 ÷ sides closes every shape, because the turns of any closed polygon add up to 360 degrees.

3. Call it (10 minutes)

when green flag clicked
erase all
polygon (3) (60)
polygon (4) (60)
polygon (6) (60)

Now the program is 1 definition plus 3 calls. Students compare it with step 1 and explain, in a sentence, why this version is more efficient. That explanation is the C3.2 language of the expectation.

4. Predict, change, test (10–15 minutes)

Before each change, students write down what they expect, then run it and explain the result.

  • Call polygon (36) (10). What shape appears? (It looks almost like a circle: 36 sides with turns of 10 degrees.)
  • Add a counter: make a variable shapes drawn, set it to 0, and change it by 1 inside polygon. After the three calls, what does it show? (3.)
  • Use a loop to call polygon (sides) (40) for sides = 3 to 8, adding 1 to sides each time. How many blocks did that save?
  • Debug challenge: give students a version with the turn block placed outside the repeat. What goes wrong, and why?

Micro:bit version

In MakeCode, create a function called flash with a number input times that shows an icon and clears the screen inside a repeat (times) loop. Call it with different numbers when buttons A and B are pressed, and keep a counter of total flashes on the screen.

Want a trained instructor to teach this for you?

Cyber Square sends a trained, police-checked instructor into your school every week. We bring the Micro:bit robotics kits and ready-made lessons that connect to the Grade 7 coding expectations, and your teacher can observe or learn alongside the class. Groups of up to 15 students, during the school day or as an after-school club.

See the full Programs page, or read about our program for Durham Region schools.

Other grades

Every grade's coding expectations, Grades 1 to 8, on one printable page: Ontario coding curriculum checklist. Or see Grade 4 coding (nested loops).

Grade 7 coding: common questions

What is new in Grade 7 coding in Ontario?

Code involving events influenced by a defined count and/or sub-program. In practice that means counters and reusable sub-programs (functions or custom blocks), and explaining how changes affect both the outcome and the efficiency of the code.

What is a sub-program in Grade 7 coding?

A named, reusable piece of code, called a function or procedure in text languages and a custom block (My Blocks) in Scratch. Students define it once and call it whenever they need it, often with different input values.

What tools can Grade 7 students use?

Scratch (My Blocks), MakeCode for the Micro:bit (Functions) or beginner Python all work. Any tool where students write, run, read and change code meets the expectation.

How does Grade 7 coding connect to the rest of the math curriculum?

Coding is part of the Algebra strand. Grade 7 activities like the one on this page also use angles and variables, so they reinforce the math students are already learning.

Can someone teach the coding part for us?

Yes. Cyber Square sends a trained, police-checked instructor into your school every week, with Micro:bit robotics kits and ready-made lessons connected to these expectations. Your teacher can observe or join in.

Get a proposal for your school

Tell us a little about your school. We'll email you a proposal with dates and pricing.

What happens next

  1. 1We reply by email within 1 business day.
  2. 2You pick a day and time that suits your timetable.
  3. 3Our instructor arrives with the kits.

Prefer email or phone? ijas@cybersquare.ca · +1 647-931-3171

Fields marked * are required.

Grades you're interested in
How would you like to run it?
When would you like to start?

We reply by email within 1 business day. We never share your information.