Unit 4 Lesson 03 Loops and Strings Lesson Plan
Unit 4 Lesson 03 Loops and Strings Lesson Plan
Overview
This lesson will combine two concepts: String variable and loops. Students will
use while and for loops to traverse and manipulate String objects.
CON -2
Programmers incorporate iteration and selection into code as a way of providing
instructions for the computer to process each of the many possible input values.
CON -2.F: For algorithms in the context of ➢ CON-2.F.1: There are standard
a particular specification that involves algorithms that utilize String
String objects: traversals to:
● Identify standard algorithms. ● Find if one or more substrings has
● Modify standard algorithms. a particular property
● Develop an algorithm. ● Determine the number of
substrings that meet specific
criteria
● Create a new string with the
characters reversed
1
Lesson P lan
Lesson 4.3 : Loop s an d St r in gs
Day 1
2
Lesson P lan
Lesson 4.3 : Loop s an d St r in gs
Day 2:
● Hook/Motivation (5 mins):
○ Check for Understanding 4-3-2: students complete individually.
○ Discuss as a class what mistakes were made during attempts to complete.
● Experiences and Explorations (30 mins):
○ Direct Instruction: Go through 4.3.2. For Loops: Reverse String on
Runestone.
○ Guided Practice: Run Active Code in Activity 3 and guide students to
make the required changes.
○ Programming Challenge
■ Students should work in pairs to complete the Programming
Challenge on Runestone
○ Independent Practice
■ Students individually complete Unit 4.3 Worksheet (Solutions)
● Rethink, Reflect, and/or Revise (10 mins):
○ Go over Solutions to Unit 4.3 Worksheet
3
Lesson P lan
Lesson 4.3 : Loop s an d St r in gs
4
Lesson P lan
Lesson 4.3 : Loop s an d St r in gs
● This video from Udacity shows the contains() method and how it can be used
with a String traversal to find vowels in a String. The contains() method is not on
the AP test, but it is a handy method!
Back gr ou n d Kn owled ge
This Youtube video from Nick Parlante (Codingbat) explains how to use
substring in a Codingbat problem.
T each in g T ip s
● CSP →CS A Tips
○ Students who took CSP should be familiar with the iteration process.
However, combining Strings and String methods with iteration is a new
concept. These concepts should be drilled both separately and together.