1 of 15

The Arizona STEM Acceleration Project

Math Magic through Coding!

2 of 15

Math Magic through Coding!

A 2nd Grade STEM Lesson

Tara Fulton

January 2024

3 of 15

Notes for Teachers

  • This lesson plan is intended for a 45-60 minute class period.

  • Student groups of 2-4 are encouraged.

  • Emphasize key vocabulary throughout the lesson and require use of the language from students (consider providing sentence frames).

  • The targeted outcome requires students to develop an algorithm, a set of step-by-step instructions, to complete a task (program an object to collect a specific amount of coins).

  • Facilitate student reflection on algorithms, what a bug is, an example of one they found in their algorithm, what debugging is, and and example of how they debugged their program.

List of Materials

  • Vocabulary Cards with word, image and short definition (words: algorithm, bug, debug)

  • PBS Kids Peg + Cat “Hungry Pirates”
    • Website:

Hungry Pirates . Games . peg + cat | PBS KIDS

  • Bee-Bot Online Emulator
    • Website:

https://beebot.terrapinlogo.com/?beebot_lessons

  • Printed Copies:
    • Money Coins 3x4 Mat
    • Sequence Organizer
    • Directional Arrows

4 of 15

Arizona Math Content Standard:

2.NBT.B.5: Fluently add and subtract within 100 using strategies based on place value, properties of operations, and/or the relationship between addition and subtraction.

2.MD.C.8: Solve word problems involving collections of money, including dollar bills, quarters, dimes, nickels, and pennies. Record the total using $ and ¢ appropriately.

Arizona Math Practice Standards:

MP 1 Make sense of problems and persevere in solving them

MP 2 Reason abstractly and quantitatively

MP 3 Construct viable arguments and critique the reasoning of others

MP 4 Model with mathematics.

MP 5 Use appropriate tools strategically.

MP 6 Attend to precision.

MP 7 Look for and make use of structure.

MP 8 Look for and express regularity in repeated reasoning.

Language, Conventions of Standard English:

2.L.1 Demonstrate command of the conventions of Standard English grammar and usage when writing or speaking.

Speaking and Listening:

2.SL.6 Produce complete sentences when appropriate to task and situation.

AZ ELP Standard 10:

2-3.ELP.10 Make accurate use of standard English to communicate in grade appropriate speech and writing.

K-2.1.c. Students, with guidance, learn to recognize feedback from both people and features embedded in digital tools, and use age appropriate technology to share learning.

Concept: Algorithms and Programming (AP)

Subconcept: Algorithms (A) 2.AP.A.1 Model daily processes by following algorithms (sets of step-by-step instructions) to complete tasks.

Subconcept: Variables (V) 2.AP.V.1 Model the way programs store and manipulate data by using numbers or other symbols to represent information.

Subconcept: Program Development (PD) 2.AP.PD.1 With teacher assistance identify plans that describe a program’s sequence of events, goals, and expected outcomes.

2.AP.PD.3 With teacher assistance, debug (identify and fix) errors in an algorithm or program that includes sequences and simple loops.

Science and Engineering Practices

  • ask questions and define problems
  • develop and use models
  • plan and carry out investigations
  • analyze and interpret data
  • use mathematical and computational thinking
  • construct explanations and design solutions
  • engage in argument from evidence
  • obtain, evaluate and communicate information

5 of 15

National Standards

Computer Science (CSTA K-12 Standards)

  • 1A-AP-08: Model daily processes by creating and following algorithms (sets of step-by-step instructions) to complete tasks.
    • Connection: Students create a directional algorithm using arrows to guide the "piggy bank" to collect specific coins on a grid.
  • 1A-AP-10: Develop programs with sequences and simple loops, to express ideas or address a problem.
    • Connection: Students sequence commands to solve the problem of navigating to the correct coins to reach a target sum.
  • 1A-AP-14: Debug (identify and fix) errors in an algorithm or program that includes sequences and simple loops.
    • Connection: Students test their algorithms, identify "bugs" (e.g., wrong turn or missing a coin), and fix the code to ensure the correct amount is collected.

Common Core Mathematics (CCSS.MATH)

  • 2.MD.C.8: Solve word problems involving dollar bills, quarters, dimes, nickels, and pennies, using $ and ¢ symbols appropriately.
    • Connection: Students must calculate the total value of coins needed (e.g., adding quarters and dimes) to match the target amount before or during the coding process.
  • 2.NBT.B.5: Fluently add and subtract within 100 using strategies based on place value, properties of operations, and/or the relationship between addition and subtraction.
    • Connection: The core activity involves adding coin values together (e.g., 25 + 10 + 5) to verify the total collected matches the goal.

Common Core English Language Arts (CCSS.ELA)

  • SL.2.1: Participate in collaborative conversations with diverse partners about grade 2 topics and texts with peers and adults in small and larger groups.
    • Connection: Students work in small groups (2-4) to brainstorm their algorithms, discuss strategies, and troubleshoot errors together.
  • L.2.6: Use words and phrases acquired through conversations, reading and being read to, and responding to texts.
    • Connection: Students use specific technical vocabulary such as "algorithm," "bug," and "debug" during their planning and reflection phases.

6 of 15

Objective(s):

  • Today we will create an algorithm to move an object to a different location using our skill of adding within 100.

  • Today we will debug errors in an algorithm.

  • Today we will express our algorithms clearly to others and make sense of different algorithms.

7 of 15

Agenda (45-60 minutes)

  • Vocabulary: What is an algorithm? What are bugs in a program? What does it mean to debug a program?

  • Application: Find the Bug! Debug the algorithm.

  • Virtual Activity: Hungry Pirate by PBS Kids Peg + Cat

  • Virtual Activity: Bee-Bot Online Emulator

  • Hands-On Activity: Create your own algorithm

  • Synthesis: Share and Discuss Algorithms

8 of 15

Vocabulary

What gestures could we use to help remember each word?

Algorithm: a set of step-by-step instructions

Bug: an error in a program

Debug: find and fix errors in a program

Images Source: https://www.canva.com/

9 of 15

Find the Bug!

Choose a library book.

Put book in backpack.

Check out book with librarian.

Put numbers by each direction to put them in the correct order.

1

2

3

Debugging

Finding and fixing errors in programs.

ALGORITHM

10 of 15

Hungry Pirates

Learn how to use directional

arrows to move the hungry pirate to the treasure.

11 of 15

Bee-Bot Online Emulator

Program a virtual Bee-Bot to collect all of the highest valued coin on The U.S. Coins Mat.

Use the directional arrows to order the movements of the Bee-Bot to collect all

of the quarters!

12 of 15

Create an algorithm to help collect 77 cents for the piggy bank.

Place the correct arrows on your organizer to show each move your caterpillar will make.

YOUR TURN!!!

1.

2.

3.

4.

5.

6.

7.

8.

9.

10.

13 of 15

Hands-On Activity Instructions

  • In a group of 2-4, create an algorithm to collect the correct amount of money in the piggy bank.
  • Use directional arrows to create an algorithm for the piggy bank to travel

  • Use the organizer to show each move of the piggy bank

  • Test the algorithm

  • Talk about any bugs in the program and think of strategies to debug errors

  • Share your algorithm with the class and determine who created the shortest algorithm

14 of 15

Assessment

  • We can create an algorithm to move an object to different points.
  • We can express our algorithm clearly to others.
  • We can make sense of different algorithms created by others.

15 of 15

Differentiation

Ensure student understanding of the context and consider language demands. The use of language supports: vocabulary cards on desk, gestures, sentence frames, etc. can support English Learners.

Encourage students to use physical movement to make sense of the algorithm by creating a 4x4 grid on the floor with masking tape for them to move one.

Modify the directions to a lower value of coins for students who may struggle to add within 25 or 50.

Remediation

Extension/Enrichment

Provide different algorithms to students to test that have hidden bugs. Expect students to explain how to debug the program.

Allow students to create an algorithm with a bug for their partner to find.

Challenge students to find the shortest or longest algorithm with the same or different context.