Grade 8

C3.1 solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves the analysis of data in order to inform and communicate decisions
C3.2 read and alter existing code involving the analysis of data in order to inform and communicate decisions, and describe how changes to the code affect the outcomes and the efficiency of the code

Scroll down this page to see all activities available, or use the buttons below to quickly access specific activities.

READ & ALTER EXISTING CODE

Typically, in math class, a child's reaction to a wrong answer is to try to forget it as fast as possible. In coding, 'the programmer is encouraged to study the bug rather than forget the error.' ~Papert

Debugging

A great example of an activity to read and alter code is to debug the code. This means, whenever you have an error, you will need to figure out where things went wrong. Read the code, alter the code, and then execute!

Watch the video on the left to watch a brief video that describes what debugging is all about. Then try the two debugging activities below.

Transformation Challenges - Students will be able to read existing code, analyze the outcome, and then proceed to code the given challenge (provided in comments section of the program).

Rotation Challenge

Open program for more details.

Translation Challenge

Open program for more details.

Reflection Challenge

Open program for more details.

Students can 'see inside' the program to read the code for 3 squares drawn. They are to note the similarities and differences between each section of code and how it impacts the outcome for each square drawn.

Students can remix this activity to start altering the code and see how these changes would impact the images drawn.

Conditional Statements Example

Have students run this program by clicking on the green flag and move their cursor up, down, left and right. They will see quickly what is going on when Scratchy the Cat touches the sky, trees, and ground.

Have them 'look inside' to read the code and see how it works.

Extension: Students can create a new background and change the code to reflect the new items that Scratchy would touch.

Monkey Mystery Game

Click the Green Flag to play this Scratch game. A banana is hidden behind one of these monkeys.

Students can remix this program and try to do the following:

  • Change the banana to hide behind a different monkey

  • Add a second object, such as a spider, behind a monkey

  • Extended Challenge: If spider is found before the banana, end the game.

Make a Scrolling Background in Scratch

Watch the tutorial on the right. By the end of the video you will be able to make a moving background, including the ability to add multiple scenes, worlds, and locations. Not only will conditional statements be used, but there will also be a discussion on how to translate sprites using the Cartesian plane (E1.4), and inequalities.

Try it out!

Blank Scratch Page: https://scratch.mit.edu/projects/editor

Or

Remix this Page (click on green Remix button): https://scratch.mit.edu/projects/485684952/

Create & Execute Efficient Code

What is the same? What is different? What do you think happens?

You can provide unplugged opportunities for students to read and analyze code by grabbing a snippet of code and asking what is happening. A great example of this given above. This was created using Scratch.

Another example of efficient code can be found on the right. This was created using Python. In the top portion, the variable x is assigned to a value of 5. The next line has variable x = x + 10, which means x is now equal to whatever current x value is and add 10. Then we print x, which is 15.

The second section of code is equivalent to the top section of code. It is using a short cut of += to replace 'x +' on the right hand side of the equal sign. These two programs would be considered to be equivalent code since they provide the same output, just with one being more efficient than the other.

Code.org does a fantastic job in this Frozen activity in helping students learn how to code and build up to efficient transformations to make snowflakes and circles. As students progress, it can get difficult - which is a great opportunity for students to stop, think, and try different scenarios to narrow down the right code to create the desired outcome.

Have students read and analyze the code for both balls in this activity. They will need to click on each ball on the right hand side to view code for each one. Have them pay attention to the differences and similarities in the code for each ball. Have them determine which one was more efficient, and how a count feature was used in a conditional statement.

Students are encouraged to create a third ball and create efficient coding steps to have it bounce like the other two balls. They can choose to play with height and wait times with this new ball.

Equivalent Coding - Divers

In mathematics, we have equivalent fractions, expressions, ratios, and so on. In coding, we also have equivalent coding. This would be where we have similar/different code, but the same output results.

For example, in this Scratch activity, Divers, students will see that when they click on either Diver 1 or Diver 2 at the top, the divers will slide in from the left and stop and then disappear. Both will move the same way. Students can then 'See inside' the program to see how each diver is programmed. They can determine how the coding is the same, different, and which one would be considered more efficient.

Twinkle Twinkle Little Star - Make More Efficient

Remix this program so that Twinkle Twinkle Little Star still plays, but the code is condensed. If you are successful, you created equivalent code that is more efficient.

To find out how you can add music code blocks to your future Scratch programs, click here. Note, this would need to be done every time you start a new Scratch program.

Bug Walking Activities (Introduction to Coding with Scratch)

On pages 7 - 19 in this digital book you will be looking at 4 activities created in Scratch that help students become familiar with Scratch and using the Pen tool to create squares. Students will be learning how to use sequence of events, repeat blocks, and then nested repeat blocks.

Inequalities (Introduction to Coding Inequalities with Scratch)

On pages 96 - 111 in this digital book teachers are provided with great guided unplugged activities to dig into inequalities, including a worksheet 'About Inequalities' that can be provided to students in English or French. Teachers are then given notes on how students will move forward to code with inequalities like x > 100, x + 50 > 100, and 2x + 40 > 100, using Scratch.

Plotting __ + __ = 100 (More Practice Coding with Scratch)

Teachers may want to review notes on page 138 and unplugged activity on page 139 (p 140 in French) in this digital book. Then jump to page 144 to read the teaching notes on how you can facilitate this lessons using the pre-made Scratch activity provided on page 145 (p 146 in French).

Note: activity pages that can given to students are provided in both English and French!

Plotting Number Patterns (C1.1, 1.2)

Teachers will want to start with the Teaching notes provided on page 73. From there, students will do an unplugged graphing activity (p 74 English; p 75 French). More teaching notes will be provided on page 76 to help guide plotting number patterns in the given Scratch activity on page 77 (p 78 in French).

Fixing a Plotting Issue (C1.1, 1.2)

Teaching notes can be found on page 153 in this digital book. The activity provided on the following page will give students an opportunity to debug a given code and put in an appropriate condition to make it work properly.


Access to this resource is for TLDSB staff & Students only. To purchase a copy, go to https://learnx.ca/onmath/

Analysis of Data

Introduction to Variables

Start off with something simple when introducing variables for the first time in Scratch. Watch the video on the left. You and your students can access this program by clicking on the button below. Make sure to remix the program to get your copy of it and try adding the Steps variable.

Ice Hopping Conditional Statements with Life counter

Pinnguag's Ice Hopping activity will use conditional statements, loops (repeating blocks), and a counter - to inform and communicate decisions.

Description of activity:

The game we will be creating is like the game Frogger, wherein the frog has to safely dodge traffic and other hazards to get across a road, but with ice moving across the screen (can be changed to logs for northern Ontario communities). The goal is to get the boy character safely to the other side. We will be using if-then statements to make our sprites move across the screen. The game will include “lives” which will be created as a variable. We will control what happens when the lives reach 0 using an if-then statement.

Plots of Linear Relationships (C1.1, C1.2, C3.2, D1.5)

Starting on page 23 in the Understanding Math + Coding Puzzles digital book, there is a module that will walk you and your students through coding puzzles related to linear relationships.

Instructions for two activities are available in both English and in French.

Access to this resource is for TLDSB staff & Students only. To purchase a copy, go to https://learnx.ca/onmath/

Create a Jumping Game!


This great 5-step tutorial will show you how to easily create a jumping game. You can use any sprite or background that you want. While creating this game the following skills will be covered:

  • Use of loops/nested events and conditional statements

  • Movement side-to-side: translation of sprites by changing x-values (E1.4)

  • Movement up and down: translation of sprites by changing y-values (E1.4)

  • Introduce how to create a variable, called score and how to increase this value by one (counter)

  • How to use the (x,y) ordered pairs to put sprites in starting positions

  • Shrink (dilate) a sprite (E1.3)

Create a Catch Game!

This 5-step tutorial will show you how to create a catch game. While creating this game guidance is provided on how to utilize x and y for ordered pairs to translate objects vertically and horizontally (E1.4). To ensure that the game works, you will need to use control blocks, such as forever, and if-then blocks. Also, an operator block will be needed to bring in an inequality situation. In order to keep score for this catch game, a variable will need to be created and they will need to increase the score (similar to using a counter) by one for every time an object is caught.

SAMPLE: Here is a catch game, called Egg Drop, that has already been started. Students can start with this program (remix) and finish it.

Once their game is created, students can try to do the following extensions:

  • Introduce a new moving object that comes down that makes you lose points

  • Advance to a new level once a certain score is reached when dropping object(s) increase in speed.

  • End the game once a certain score/level is reached


Connections: Other Curriculum Expectations + Coding

Below you will find activities created by educators in TLDSB and beyond. Curriculum aligned expectations will be noted in each activity and provided with more detail at the bottom of this page.

Coding YouTube (C 1.4, C 3.1, 3.2, B 1.1)

Do your students want to become YouTube stars? Students will learn how to Monetize a YouTube Channel and use coding to predict the revenue a YouTube video can generate.

Click here to access all the resources you need to dig into this incredible project with your students.

Number Pattern Expressions (C1.2, C3.2)

On page 20 in the Understanding Math + Coding Puzzles digital book, there are teaching notes that explain how students can learn to use algebraic expressions in their code. Solutions are also provided on this page. Student instructions, including a link to the program that they will work with, can be found on page 21 (English) and page 22 (French).

Access to this resource is for TLDSB staff & Students only. To purchase a copy, go to https://learnx.ca/onmath/

Start Small - Making Informed Financial Decisions (F1.3)

Creating a Budget

Click here for link to this presentation.

This lesson is similar to the budget created in the presentation on the left. Students will code using Google Sheets or any spreadsheet program. Students will be creating a budget to help plan for a financial goal while considering earnings and expenses.

OAME Activity

Number

B1.1 represent and compare very large and very small numbers, including through the use of scientific notation, and describe various ways they are used in everyday life

Algebra

C1.1 identify and compare a variety of repeating, growing, and shrinking patterns, including patterns found in real-life contexts, and compare linear growing and shrinking patterns on the basis of their constant rates and initial values

C1.2 create and translate repeating, growing, and shrinking patterns involving whole numbers and decimal numbers using various representations, including algebraic expressions and equations for linear growing patterns and shrinking patterns


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 involving the analysis of data in order to inform and communicate decisions, and describe how changes to the code affect the outcomes and the efficiency of the code

Data

D1.5 use mathematical language, including the terms “strong”, “weak”, “none”, “positive”, and “negative”, to describe the relationship between two variables for various data sets with and without outliers

Spatial Sense

E1.4 describe and perform translations, reflections, rotations, and dilations on a Cartesian plane, and predict the results of these transformations

Financial Literacy

F1.3 identify different ways to maintain a balanced budget, and use appropriate tools to track all income and spending, for several different scenarios