Lesson 13: Nested Loops with Frozen
Overview
Now that students know how to layer their loops, they can create so many beautiful things. This lesson will take students through a series of exercises to help them create their own portfolio-ready images using Anna and Elsa's excellent ice-skating skills!
Purpose
In this series, students will get practice nesting loops while creating images that they will be excited to share.
Beginning with a handful of instructions, students will make their own decisions when it comes to creating designs for repetition. They will then spin those around a variety of ways to end up with a work of art that is truly unique.
Agenda
Warm Up (15 min)
Main Activity (30 min)
Wrap Up (15 min)
View on Code Studio
Objectives
Students will be able to:
- Describe when a loop, nested loop, or no loop is needed.
- Recognize the difference between using a loop and a nested loop.
- Break apart code into the largest repeatable sequences using both loops and nested loops.
Preparation
- Play through the puzzles to find and 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
Ask the class to discuss the last set of puzzles.
- What did they like/dislike?
- Which puzzles were hard? Why?
- Which puzzles were easy? Why?
- If you were to teach nested loops to a friend, what would you say to help them understand?
If there's time, give an introduction to the main characters of today's puzzles, Anna and Elsa from Frozen. Give the class the sister's back story if the class doesn't already know. To build excitement, tell the class they will be using nested loops to make some fantastic drawings with Anna and Elsa's ice skates!
Main Activity (30 min)
Code Studio
This set of puzzles is set up as a progression. This means every puzzle builds a foundation for the next puzzle. Students will enjoy making more and more interesting designs by making small and simple changes to code they have already written.
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?
- When do you use a loop? When do you use a nested loop?
- Thought exercise: Can you make everything a nested loop can with just a normal loop? Can you draw out an example?
- Answer: Yes, you can, but it is a lot more difficult. Nested loops make programs simpler.
Teaching Tip
This lesson contains a mini-project called Snowflake #1. This progression may feel very different from what has come earlier in the course for you as well as your students. These levels have some new characteristics you may want to explore before starting.
- The code your students write in one level will automatically transfer over to the other levels. This allows them to build gradually and iterate on their ideas as they learn.
- These levels are not checked for correctness to allow for more open-ended creativity. Empower your students to determine for themselves when they have completed each task. There is no one right answer!
- Example solutions are available for this step of the progression which can be viewed by opening the teacher panel to the right.
Student Instructions
“Hi, I’m Elsa of Arendelle, help me draw a shape.”
Draw a small shape, between 20 and 50 pixels wide. It can be any shape that you like.
You can try making a polygon, like one of these:
Or even an abstract shape, like one of these:
Teaching Tip
This lesson contains a mini-project called Snowflake #1. This progression may feel very different from what has come earlier in the course for you as well as your students. These levels have some new characteristics you may want to explore before starting.
- The code your students write in one level will automatically transfer over to the other levels. This allows them to build gradually and iterate on their ideas as they learn.
- These levels are not checked for correctness to allow for more open-ended creativity. Empower your students to determine for themselves when they have completed each task. There is no one right answer!
- Example solutions are available for this step of the progression which can be viewed by opening the teacher panel to the right.
Student Instructions
“Now, let’s draw more than one.”
Now take your shape and draw two or three in a row by jumping forward some number of pixels.
- If you jump forward by less than the width of your shape, they might overlap
- If you jump forward by more than the width of your shape, you will get a gap
Your row might end up straight like with these:
Or, your shapes might move around like one of these:
Teaching Tip
This lesson contains a mini-project called Snowflake #1. This progression may feel very different from what has come earlier in the course for you as well as your students. These levels have some new characteristics you may want to explore before starting.
- The code your students write in one level will automatically transfer over to the other levels. This allows them to build gradually and iterate on their ideas as they learn.
- These levels are not checked for correctness to allow for more open-ended creativity. Empower your students to determine for themselves when they have completed each task. There is no one right answer!
- Example solutions are available for this step of the progression which can be viewed by opening the teacher panel to the right.
Student Instructions
"Let’s make it into a snowflake."
Next, jump Elsa back to the center using the jump to 200 over and 200 down
block, and spin her around to draw the line of shapes again and again in a bunch of different directions.
What amazing snowflakes you can make!
Take a look at these examples with polygons:
Abstract shapes might make a snowflake more like one of these:
Teaching Tip
This lesson contains a mini-project called Snowflake #1. This progression may feel very different from what has come earlier in the course for you as well as your students. These levels have some new characteristics you may want to explore before starting.
- The code your students write in one level will automatically transfer over to the other levels. This allows them to build gradually and iterate on their ideas as they learn.
- These levels are not checked for correctness to allow for more open-ended creativity. Empower your students to determine for themselves when they have completed each task. There is no one right answer!
- Example solutions are available for this step of the progression which can be viewed by opening the teacher panel to the right.
Student Instructions
"What happens if we draw snowflakes on top of each other?"
Try layering two different shapes of snowflakes on top of one another with a little turn in between - see what you get!
Teaching Tip
This lesson contains a mini-project called Snowflake #1. This progression may feel very different from what has come earlier in the course for you as well as your students. These levels have some new characteristics you may want to explore before starting.
- The code your students write in one level will automatically transfer over to the other levels. This allows them to build gradually and iterate on their ideas as they learn.
- These levels are not checked for correctness to allow for more open-ended creativity. Empower your students to determine for themselves when they have completed each task. There is no one right answer!
Student Instructions
"Get creative with shapes and angles to see what kind of new snowflakes we can draw!"
Teaching Tip
This lesson contains a mini-project called Snowflake #1. This progression may feel very different from what has come earlier in the course for you as well as your students. These levels have some new characteristics you may want to explore before starting.
- The code your students write in one level will automatically transfer over to the other levels. This allows them to build gradually and iterate on their ideas as they learn.
- These levels are not checked for correctness to allow for more open-ended creativity. Empower your students to determine for themselves when they have completed each task. There is no one right answer!
- Example solutions are available for this step of the progression which can be viewed by opening the teacher panel to the right.
Student Instructions
"Let’s try something new. This time, skate in a zig-zag."
Draw a stair-step pattern that uses turns between 75 and 105 degrees -- but make sure that your left and right turns use the same angle.
(You will see why later.)
Teaching Tip
This lesson contains a mini-project called Snowflake #2. This progression may feel very different from what has come earlier in the course for you as well as your students. These levels have some new characteristics you may want to explore before starting.
- The code your students write in one level will automatically transfer over to the other levels. This allows them to build gradually and iterate on their ideas as they learn.
- These levels are not checked for correctness to allow for more open-ended creativity. Empower your students to determine for themselves when they have completed each task. There is no one right answer!
- Example solutions are available for this step of the progression which can be viewed by opening the teacher panel to the right.
Student Instructions
"Now let’s turn and go back the way we came."
Turn around 180 degrees and draw the exact same stair pattern again!
- The rest of this stage will be easier if you put all of your code inside of a loop to make Elsa draw, turn around 180 degrees, draw, then turn around 180 degrees again.
Here is an example of stairs that use a 76 degree turn:
Teaching Tip
This lesson contains a mini-project called Snowflake #2. This progression may feel very different from what has come earlier in the course for you as well as your students. These levels have some new characteristics you may want to explore before starting.
- The code your students write in one level will automatically transfer over to the other levels. This allows them to build gradually and iterate on their ideas as they learn.
- These levels are not checked for correctness to allow for more open-ended creativity. Empower your students to determine for themselves when they have completed each task. There is no one right answer!
- Example solutions are available for this step of the progression which can be viewed by opening the teacher panel to the right.
Student Instructions
"Let’s spin and make it into a snowflake."
Spin that shape around 5 or 6 times in a circle. - If you choose 5 times, try a turn of 72 degrees - If you choose 6 times, try a turn of 60 degrees
Here's an example of Elsa turning a pattern 6 times:
Teaching Tip
This lesson contains a mini-project called Snowflake #2. This progression may feel very different from what has come earlier in the course for you as well as your students. These levels have some new characteristics you may want to explore before starting.
- The code your students write in one level will automatically transfer over to the other levels. This allows them to build gradually and iterate on their ideas as they learn.
- These levels are not checked for correctness to allow for more open-ended creativity. Empower your students to determine for themselves when they have completed each task. There is no one right answer!
- Example solutions are available for this step of the progression which can be viewed by opening the teacher panel to the right.
Student Instructions
"Now, what should we do? Let’s explore and create our own winter wonderland!"
Try playing around with what you've created. Draw whatever you like! - What happens if you use two different angles in your stair step pattern? - What happens if you make your diamond pattern longer or shorter? - What does it look like to draw two snowflakes on top of one another?
Standards Alignment
View full course alignment
CSTA K-12 Computer Science Standards (2017)
AP - Algorithms & Programming
- 1B-AP-11 - Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process.
- 1B-AP-13 - Use an iterative process to plan the development of a program by including others' perspectives and considering user preferences.
Cross-curricular Opportunities
This list represents opportunities in this lesson to support standards in other content areas.
Common Core Math Standards
MD - Measurement And Data
- 4.MD.5 - Recognize angles as geometric shapes that are formed wherever two rays share a common endpoint, and understand concepts of angle measurement:
- 4.MD.5.a - An angle is measured with reference to a circle with its center at the common endpoint of the rays, by considering the fraction of the circular arc between the points where the two rays intersect the circle. An angle that turns through 1/360 of a circle i
- 4.MD.5.b - An angle that turns through n one-degree angles is said to have an angle measure of n degrees.
MP - Math Practices
- 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
OA - Operations And Algebraic Thinking
- 4.OA.1 - Interpret a multiplication equation as a comparison, e.g., interpret 35 = 5 × 7 as a statement that 35 is 5 times as many as 7 and 7 times as many as 5. Represent verbal statements of multiplicative comparisons as multiplication equations.
- 4.OA.5 - Generate a number or shape pattern that follows a given rule. Identify apparent features of the pattern that were not explicit in the rule itself. For example, given the rule “Add 3” and the starting number 1, generate terms in the resulting sequence and
Next Generation Science Standards
ETS - Engineering in the Sciences
ETS1 - Engineering Design
- 3-5-ETS1-1 - Define a simple design problem reflecting a need or a want that includes specified criteria for success and constraints on materials, time, or cost.