Lesson 7: Loops with Harvester

Overview

Building on the concept of repeating instructions from "Getting Loopy," this stage will have students using loops to pick corn more efficiently on Code.org.

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 the Code.org puzzles, students will learn to add instructions to existing loops, gather repeated code into loops, and recognize patterns that need to be looped.

Agenda

Warm Up (10 min)

Bridging Activity - Loops (10 min)

Main Activity (30 min)

Wrap Up (5 - 10 min)

Extended Learning

View on Code Studio

Objectives

Students will be able to:

  • Identify the benefits of using a loop structure instead of manual repetition.
  • Break down a long sequence of instructions into the smallest repeatable sequence possible.
  • Create a program for a given task which loops a sequence of commands.
  • Employ a combination of sequential and looped commands to reach the end of a maze.

Preparation

  • Play through the puzzles to find any potential problem areas for your class.
  • Review CS Fundamentals Main Activity Tips - Lesson Recommendations.
  • Make sure each student has a Think Spot Journal - Reflection Journal.
  • (Optional) Pick a couple of puzzles to do as a group with your class.
  • (Optional) If you haven't already, print and cut out blocks from Unplugged Blockly Blocks (Grades K-1) - Manipulatives to prepare for one of the bridging activities in this lesson.

Links

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

For the Teachers

For the Students

Vocabulary

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

Support

Report a Bug

Teaching Guide

Warm Up (10 min)

Introduction

Review the Getting Loopy activity with your students:

  • What are loops?
  • Why do we use them?

Bridging Activity - Loops (10 min)

This activity will help bring the unplugged concepts from "Getting Loopy" into the online world that the students are moving into. Choose one of the following to do with your class:

Unplugged Activity Using Paper Blocks

Revisit the dance from "Getting Loopy." This time, work with the class to "code" it out using Unplugged Blockly Blocks (Grades K-1) - Manipulatives instead of writing the dance instructions on paper. Make sure the students know that the blocks need to go from top to bottom and they all need to touch!

Previewing Online Puzzles as a Class

Pull up the online puzzles and choose a puzzle to do in front of the class. We recommend puzzle 7. Ask the students to write a program to solve the puzzle on paper. Have the students circle repeated chunks and label with the number of repeats, the same way they did in "Getting Loopy."

Main Activity (30 min)

Online Puzzles

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

Wrap Up (5 - 10 min)

Journaling

Having students write about what they learned, why it’s useful, and how they feel about it can help solidify any knowledge they obtained today and build a review sheet for them to look to in the future.

Journal Prompts:

  • What was today’s lesson about?
  • Draw one of the Feeling Faces - Emotion Images that shows how you felt about today's lesson in the corner of your journal page.
  • How did loops make your program easier to write?
  • Draw something that uses loops.

Extended Learning

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!
  • Practice
  • 1
  • 2
  • (click tabs to see student view)
View on Code Studio

Student Instructions

Help the harvester pick all the corn!

View on Code Studio

Student Instructions

The harvester needs to pick all the corn! Do you see a pattern?

  • Repeat Blocks
  • 3
  • (click tabs to see student view)
View on Code Studio

Student Instructions

Can you pick all the corn using only one move block?

View on Code Studio

Student Instructions

"I need help to find what's wrong!"

Can you help the harvester find the bug in her code?

View on Code Studio

Student Instructions

Try it yourself! Can you pick the corn at the end too?

View on Code Studio

Student Instructions

Look at all this corn? Can you pick it all by yourself?

View on Code Studio

Student Instructions

Can you change your code to make the harvester pick all the corn?

View on Code Studio

Student Instructions

You will need one move west block and one move north block to finish this puzzle!

View on Code Studio

Student Instructions

Try it on your own!

  • Challenge
  • 11
  • (click tabs to see student view)
View on Code Studio

Student Instructions

Can you figure out how to pick all this corn?

  • Practice
  • 12
  • 13
  • (click tabs to see student view)
View on Code Studio

Student Instructions

Help the harvester pick all five ears of corn!

View on Code Studio

Student Instructions

Try one more on your own!

Standards Alignment

View full course alignment

CSTA K-12 Computer Science Standards (2017)

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 - 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.