Lesson 9: Drawing Shapes with Loops

Overview

This lesson builds on the understanding of loops from previous lessons and gives students a chance to be truly creative. This activity doubles as a debugging exercise for extra problem-solving practice.

Purpose

This series highlights the power of loops with an array of puzzles meant to get students thinking about why repeat loops are superior to longhand.

Agenda

Warm Up (15 min)

Main Activity (30 min)

Wrap Up (15 min)

View on Code Studio

Objectives

Students will be able to:

  • Identify the benefits of using a loop structure instead of manual repetition.
  • Differentiate between commands that need to be repeated in loops and commands that should be used on their own.

Preparation

  • Play through the puzzles to find any potential problem areas for your class.
  • Make sure every student has a journal.

Vocabulary

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

Support

Report a Bug

Teaching Guide

Warm Up (15 min)

Introduction

Students should have had an introduction to loops at this point. Based on what you think your class could benefit from, we recommend:

  • Reviewing a puzzle from the last lesson
  • Previewing a puzzle from this lesson

Any of these should help prepare your class for fun with the online puzzles!

Main Activity (30 min)

Online Puzzles

Some students may discover where to add repeat loops by writing out the program without loops then circling sections of repetitions. If the students in your class seem like they could benefit from this, have them keep paper and pencils beside them at their machines. Students might also enjoy drawing some of the shapes and figures on paper as they program online.

Wrap Up (15 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?
  • How did you feel during today’s lesson?
  • What was the coolest shape or figure you programmed today? Draw it out!
  • What is another shape or figure you could program using loops? Can you come up with the code to create it?
  • Artist Intro with JR Hildebrand
  • 1
  • (click tabs to see student view)
  • Practice
  • 2
  • 3
  • (click tabs to see student view)
View on Code Studio

Student Instructions

What a lovely day!

Help the Artist cover his flowers before the winter by moving forward by 60 pixels.

View on Code Studio

Student Instructions

Add some beauty by repeating that step five times, changing to a random color between each move.

  • Loops with the Artist
  • 4
  • (click tabs to see student view)
View on Code Studio

Student Instructions

Draw the colorful line 5 times again, this time using a repeat loop.

View on Code Studio

Student Instructions

You can create this star by looping a sequence of move forward and turn right by 144 degrees blocks.

View on Code Studio

Student Instructions

Loops sure make writing code easier!

Use loops to draw this staircase. - Each stairstep is 50 pixels long and 50 pixels tall - You will need to turn 90 degrees in each direction

View on Code Studio

Student Instructions

This staircase is much bigger, but it takes the same amount of code as the last puzzle!

Fix this loop to complete the puzzle.

View on Code Studio

Student Instructions

Look for a pattern and make this code shorter using loops!

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

Student Instructions

Challenge: Look for a pattern and make this code shorter using loops.

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

Student Instructions

Solve this puzzle by drawing a square with 200 pixel sides.

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.