< Course D (2021)

Lesson 9: Loops in Ice Age

45 minutes

Overview

This context-setting/skill-building lesson will quickly introduce students to loops.

Purpose

In this lesson, students will be learning more about loops and how to implement them in Blockly code. Using loops is an important skill in programming because manually repeating commands is tedious and inefficient. With these Code.org puzzles, students will learn to add instructions to existing loops, gather repeated code into loops, and recognize patterns that need to be repeated.

CSTA K-12 Computer Science Standards (2017)
    • 1A-AP-09 - Model the way programs store and manipulate data by using numbers or other symbols to represent information.
    • 1A-AP-10 - Develop programs with sequences and simple loops, to express ideas or address a problem.
    • 1A-AP-11 - Decompose (break down) the steps needed to solve a problem into a precise sequence of instructions.
    • 1A-AP-14 - Debug (identify and fix) errors in an algorithm or program that includes sequences and simple loops.

Agenda

Objectives

Students will be able to:
  • Construct a program using structures that repeat areas of code
  • Improve existing code by finding areas of repetition and moving them into looping structures

Preparation

  • (Optional) Pick a couple of puzzles to do as a group with your class.
  • Make sure each student has a reflection journal.

Links

Heads Up! Please make a copy of any documents you plan to share with students.

For the students

Vocabulary

  • Loop - The action of doing something over and over again.
  • Repeat - To do something again.

Teaching Guide

Warm Up (10 minutes)

Introduction to Loops

Model: Ask for a volunteer and have them stand.

  • Instruct your volunteer to walk around the table (or their chair, or a friend).
  • When they finish, instruct them to do it again, using the exact same words you did before.
  • When they finish, instruct again.
  • Then again.

Prompt: Would it have been easier for me to just ask you to go around the table four times?

Think: What if I wanted you to do it ten times? How would you reword my instructions so that they were more efficient and I didn't have to repeat myself so much? Feel free to write your instructions down on a piece of scrap paper.

Share: Ask a few students to share their instructions with the class, pointing out how each approach has simplified the overall approach to giving instructions.

Say: Today we're going to work on finding ways to make giving lots of instructions easier, especially when those instructions repeat themselves a lot.

Preview Loops in Ice Age

To finish the connection, preview an online puzzle (or two) as a class.

Model: Reveal an entire online puzzle from the progression to come. We recommend Puzzle 5. Point out the "Play Area" with Scrat and the acorn, as well as the "Work Space" with the Blockly code. Explain that this Blockly code is now the language that the class will be using to help Scrat get to the acorn. Do students see any similarities to the exercise that they just did? What are the big differences?

Work with your class to drag code into the workspace in such a way that Scrat (eventually) gets to the acorn.

Transition: Students should now be ready to transition to computers to complete online puzzles on their own.

Main Activity (30 minutes)

Loops in Ice Age

As students work through the puzzles, see if they can figure out how many blocks they use with a loop vs. without a loop.

Teaching Tip

Show the students the right way to help classmates by:

  • Don’t sit in the classmate’s chair.
  • Don’t use the classmate’s keyboard.
  • Don’t touch the classmate’s mouse.
  • Make sure the classmate can describe the solution to you out loud before you walk away

Circulate: Teachers play a vital role in computer science education and supporting a collaborative and vibrant classroom environment. During online activities, the role of the teacher is primarily one of encouragement and support. Online lessons are meant to be student-centered, so teachers should avoid stepping in when students get stuck. Some ideas on how to do this are:

  • Utilize *Pause and Think Online Video whenever possible.
  • Encourage students with questions/challenges to start by asking their partner.
  • Unanswered questions can be escalated to a nearby group, who might already know the solution.
  • Remind students to use the debugging process before you approach.
  • Have students describe the problem that they’re seeing. What is it supposed to do? What does it do? What does that tell you?
  • Remind frustrated students that frustration is a step on the path to learning, and that persistence will pay off.
  • If a student is still stuck after all of this, ask leading questions to get the student to spot an error on their own.

Wrap Up (5 minutes)

Reflection

Prompts:

  • What was today’s lesson about?
  • Draw your own maze with Scrat trying to get to an acorn. Will loops help you solve it?
  • Draw yourself using a loop to do an everyday activity, like brushing your teeth.

Extended Learning

Use these activities to enhance student learning. They can be used as outside of class activities or other enrichment.

So Moving

  • Give the students pictures of actions or dance moves that they can do.
    • Have students arrange moves and add loops to choreograph their own dance.
  • Share the dances with the rest of the class.

Connect It Back

  • Find some YouTube videos of popular dances that repeat themselves.
  • Can your class find the loops?
  • Try the same thing with songs!
Creative Commons License (CC BY-NC-SA 4.0).

This work is available under a Creative Commons License (CC BY-NC-SA 4.0).

If you are interested in licensing Code.org materials for commercial purposes contact us.