🏆 Grade 6 · Patterns

Applying Coding to Math – Grade 6 Math Lesson

  1. 1. 📖 Lesson
  2. 2. 🧠 Practice
Free lessons used: 3 of 5 🔓 Unlock everything

About This Grade 6 Lesson

Topic
Applying Coding to Math — Patterns unit
Grade & ages
Grade 6 · ages 11–12
Curriculum
Ontario Mathematics Curriculum, Grades 1–8 (2020)
In this lesson
1. Why Use Coding for Math? · 2. Example 1: Sum of First N Numbers · 3. Example 2: Multiplication Table · 4. Example 3: Finding Factors of a Number · 5. Let’s Practice Together! 🎉
Created by
The InukMath team
Last updated
October 19, 2026 · How we make our lessons

Applying Coding to Math – Grade 6 Lesson Notes

A quick written summary of this Grade 6 math lesson from the Patterns unit. Read it with your child, then open the interactive lesson above and try the practice questions.

Today we’re going to discover how coding helps us solve math problems quickly and accurately! Instead of doing long calculations by hand, we can write a short program that does the hard work for us. This is real-life math + coding magic! ✨

1. Why Use Coding for Math?

  • ✅ Solves big problems in seconds
  • ✅ No mistakes in repeated calculations
  • ✅ Helps us see patterns easily
  • ✅ Prepares us for real world jobs

2. Example 1: Sum of First N Numbers

Find the sum of numbers from 1 to 20.

total = 0 for number from 1 to 20: total = total + number print("The sum is", total)

3. Example 2: Multiplication Table

Create the 7 times table up to 12.

for i from 1 to 12: print(7, "×", i, "=", 7 * i)

4. Example 3: Finding Factors of a Number

Find all factors of 36.

number = 36 for i from 1 to number: if number % i == 0: print(i)

5. Let’s Practice Together! 🎉

Practice 1

What is the sum of numbers from 1 to 50?

1275 (We can use the formula n×(n+1)/2 = 50×51/2 = 1275)

Practice 2

Write a small code idea to check if 48 is even or odd.

if 48 % 2 == 0: print("Even number!") → Even number!

Challenge

How many multiples of 5 are there from 1 to 100?

20 multiples (100 ÷ 5 = 20)

6. Real Life in Canada 🇨🇦

• Calculating total cost with taxes • Finding how many school days are left in the year • Making a simple budget planner for your allowance • Predicting patterns in sports scores

You are now a Math + Coding Superstar! 🌟

Every time you use coding to solve a math problem, you become smarter and faster! Keep practicing and you can create anything you imagine. Love and proud high-fives, Mrs. Brenda ❤️

Applying Coding to Math – Sample Practice Questions

  1. You want to use code to add all numbers from 1 to 10. Which coding idea helps?

    • A) Use a loop to repeat adding the next number
    • B) Write 10 separate additions
    • C) Guess the total
    • D) Use only conditionals
    Show answer

    Answer: A) Use a loop to repeat adding the next number — Hello superstar! A loop can repeat the addition efficiently. This is a great way to apply coding to math problems!

  2. To find if a number is even using code, you can:

    • A) Use a conditional: IF number mod 2 = 0 THEN even
    • B) Use a loop only
    • C) Guess
    • D) Print the number
    Show answer

    Answer: A) Use a conditional: IF number mod 2 = 0 THEN even — Conditionals help make math decisions in code.

  3. To calculate the sum of the first 5 even numbers with code, best to use:

    • A) A loop that adds 2, 4, 6, 8, 10
    • B) Write each number separately
    • C) Use only variables
    • D) No code
    Show answer

    Answer: A) A loop that adds 2, 4, 6, 8, 10 — Loops make repeating math operations easy.

  4. In code, to check if a triangle with sides a, b, c is right-angled, you can use:

    • A) Conditional: IF a² + b² = c² THEN yes
    • B) Loop only
    • C) Variable only
    • D) Guess
    Show answer

    Answer: A) Conditional: IF a² + b² = c² THEN yes — Conditionals are perfect for math checks.

  5. To generate the pattern 5, 10, 15, 20 using code, you use:

    • A) A loop that starts at 5 and adds 5 each time
    • B) Write each number
    • C) Use only conditionals
    • D) Random numbers
    Show answer

    Answer: A) A loop that starts at 5 and adds 5 each time — Loops create math patterns efficiently.

Practise all 59 Applying Coding to Math questions →

More Grade 6 Lessons: Patterns

All Grade 6 lessons →