Lesson 9: Loops Unplugged: My Loopy Robotic Friends

Unplugged | Loop | Repeat

Overview

Here, students learn the simplicity and utility of loops by “programming” their friends using the language from "My Robotic Friends." Once loops are introduced, students will find that they can build bigger structures faster.

Purpose

This lesson serves as an introduction to loops. Loops allow for students to simplify their code by grouping commands that need to be repeated. Students will develop critical thinking skills by noticing repetition in the movements of classmates and determining how many times their code needs to be looped. By seeing "My Robotic Friends" again, students will be able to relate old concepts (such as sequencing) to the new concept of loops.

Agenda

Warm Up (10 - 15 min)

Main Activity (15 - 20 min)

Wrap Up (8 min)

Extension Activities

Objectives

Students will be able to:

  • Identify repetitive code and convert a series of multiple actions into a single loop.
  • Decode loops into a series of multiple actions.

Preparation

Links

For the Teacher

Vocabulary

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

Support

Report a Bug

Teaching Guide

Warm Up (10 - 15 min)

My Robotic Friends Review

Goal: This review will refresh the students’ minds about how quickly programs for the My Robotic Friends activity can get intense.

Revisit the rules of My Robotic Friends.

With the class together as a group, pull an easy puzzle from the My Robotic Friends Cup Stack Pack and program with each other as a reminder of rules and terminology.

Next, pull a puzzle that’s slightly harder, but also requires a lot of steps like the one below.

Ask a volunteer (or a group of volunteers) to come forward to help program this one on the board. If you make them stick strictly to the “no symbols other than those on the key” rule, it will probably take a while!

Now, bring up this image:

What is the reaction of the class?

Loops to the Rescue

Give students the opportunity to brainstorm shorter ways to relay the code that they’re about to create. (This bit can be skipped over if your students start saying things like: “Move forward 6 times.” Since that will open the discussion about how to show “six times” with symbols.)

Once students have put together the idea of “repeating” code, give them the vocabulary around it. Make sure to share with them that often the terms “repeat something” and “loop something” will be used interchangeably on Code.Org.

Main Activity (15 - 20 min)

Looping with My Robotic Friends

Goal: This activity will allow students to gain practice spotting areas that repeat loops can be used, as well as places where they need to expand programs that utilize loops.

Teaching Tips:

Be sure to keep your eyes open for students using loops. Try to avoid correcting their overall algorithms, but feel free to point out instructions that could be shortened by using a repeat circle.

Watch students as they run through the code. Are there any bugs? Use the debugging questions to help them find a solution.

  • What does it do?
  • What is it supposed to do?
  • What does that tell you?
  • Does it work at the first step?
  • Does it work at the second step?
  • Where does it stop working?

Practice Makes Perfect

Take the program from one of your previous cup stacks and display it for the class. Have them help you find places that the same arrows repeat, uninterrupted, multiple times. Have students count the number of times those arrows repeat and give you the final tally.

Circle the first arrow in that line, write the number of loops near that circle, then cross out the rest of the arrows.

Repeat this until the entire program has been shortened, then re-write the program in a way where students can see how much more simple the resulting instructions are.

Looping with My Robotic Friends

Now that students have a new tool in their toolbox, they should be able to start finding success on new (and more difficult) cup stacks.

Set students to task with the cards from the more difficult My Robotic Friends Loops Packet and see how they do. You can either continue to work together, or let students work in small groups -- whichever is best for your classroom.

Wrap Up (8 min)

Journaling

Goal: Allow students to reflect on the activity that they just experienced.

Flash Chat:

Here are some possible topics:

  • Do you feel like loops make programming easier or harder?
  • What other kinds of things in life do we repeat?
    • Eating - put food in mouth, chew 20 times
    • Brushing hair - brush through hair 35 times
    • Routines - Wake up, go to school, come home, go to bed

Journal Prompts:

  • Journal time! Ask students to draw a feeling face in the corner of their journal page to remind them how they felt about this lesson.
  • Have the students write or draw something in their journal that will remind them later what loops are. This can come from a prompt like:
    • What does "repeat" mean to you?
    • Draw a picture of you repeating something.

Extension Activities

  • Have students draw their own cup stacking creations for someone else to code.
  • Provide students with algorithms that utilize repeats, then have them expand the program back out to a full step-by-step version.

Standards Alignment

View full course alignment

CSTA K-12 Computer Science Standards

AP - Algorithms & Programming
  • 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 - Debug (identify and fix) errors in an algorithm or program that includes sequences and simple loops.
  • 1A-AP-14 - Give attribution when using the ideas and creations of others while developing programs.