Lesson 13: Conditionals & Loops in Harvester
Overview
Students will practice while
loops, until
loops, and if / else
statements. All of these blocks use conditionals. By practicing all three, students will learn to write complex and flexible code.
Purpose
Practicing the use of conditionals in different scenarios helps to develop a student's understanding of what conditionals can do. In the previous lesson, students only used conditionals to move around a maze. In this lesson, students will use conditionals to help the farmer know when to harvest crops. New patterns will emerge and students will use creativity and logical thinking to determine the conditions where code should be run and repeated.
Agenda
Warm Up (5 min)
Main Activity (30 min)
Wrap Up (15 min)
View on Code Studio
Objectives
Students will be able to:
- Nest conditionals to analyze multiple value conditions using if, else if, else logic.
- Pair a loop and conditional statement together.
Preparation
- Play through Course D Online Puzzles - Website to find any potential problem areas for your class.
- Review CS Fundamentals Main Activity Tips - Lesson Recommendations.
- Make sure every student has a Think Spot Journal - Reflection Journal.
Links
Heads Up! Please make a copy of any documents you plan to share with students.
For the Teachers
- Course D Online Puzzles - Website
- CS Fundamentals Main Activity Tips - Lesson Recommendations
For the Students
- Think Spot Journal - Reflection Journal
Vocabulary
- Condition - Something a program checks to see if it is true before allowing an action.
- Conditionals - Statements that only run under certain conditions.
- Loop - The action of doing something over and over again.
- Repeat - To do something again.
- While Loop - A loop that continues to repeat while a condition is true.
Support
Report a Bug
Teaching Guide
Warm Up (5 min)
Introduction
Students shouldn't need as much of an introduction to concepts today because they have had practice with them in the previous lesson. Instead, you can share the story of the harvester.
The harvester is trying to pick crops like pumpkins, lettuce, and corn. However, the farmer has forgotten where she planted these crops, so she needs to check each plant before harvesting.
Main Activity (30 min)
Course D Online Puzzles - Website
Students will continue to work with if / else
statements, while
loops, and until
loops. These puzzles are a bit more challenging, though, so encourage students to stick with them until they can describe what needs to happen for each program.
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 do you feel about today's lesson?
- How can you see conditionals being useful in programs?
- What if people only spoke in if/else statements? What would be some advantages and disadvantages of this?
Student Instructions
"Corn you help me harvest today?"
Use conditionals to make sure that you pick all of the corn, but don't disturb the stalks where nothing is growing yet.
Student Instructions
"Lettuce collect both crops from this row!"
Help the farmer collect both corn and lettuce from the field.
Student Instructions
Student Instructions
"Gosh! Now the crops are growing in clusters!"
Help the farmer pick all of the lettuce in each cluster before moving on to the next bunch.
Student Instructions
"What a bountiful crop!"
This field has clusters of corn, lettuce, and pumpkins all growing together. Can you collect them all?
Student Instructions
"Let's take this one step further!"
Can you figure out how to pick the pumpkin? Make sure to collect all of the corn along the way!
Student Instructions
Challenge: Collect all of the corn and lettuce, then pick the pumpkin.
Student Instructions
Collect all of the corn and lettuce, then pick the pumpkin.
Student Instructions
Collect all of the corn and lettuce, then pick the pumpkin.
Student Instructions
The sprouts in this puzzle will be either corn or lettuce.
Take a close look at the code below. What will happen after you click "Run"?
The farmer will collect all of the produce.
The farmer will not collect any of the produce with the path she is taking.
The farmer will collect all of the produce, except the pumpkin.
I don't know.
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.
Cross-curricular Opportunities
This list represents opportunities in this lesson to support standards in other content areas.
Common Core English Language Arts Standards
L - Language
- 3.L.6 - Acquire and use accurately grade-appropriate conversational, general academic, and domain-specific words and phrases, including those that signal spatial and temporal relationships (e.g., After dinner that night we went looking for them).
SL - Speaking & Listening
- 3.SL.1 - Engage effectively in a range of collaborative discussions (one-on-one, in groups, and teacher-led) with diverse partners on grade 3 topics and texts, building on others’ ideas and expressing their own clearly.
- 3.SL.3 - Ask and answer questions about information from a speaker, offering appropriate elaboration and detail.
- 3.SL.6 - Speak in complete sentences when appropriate to task and situation in order to provide requested detail or clarification.
Common Core Math Standards
MP - Math Practices
- MP.1 - Make sense of problems and persevere in solving them
- MP.2 - Reason abstractly and quantitatively
- 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
- 3.OA.3 - Use multiplication and division within 100 to solve word problems in situations involving equal groups, arrays, and measurement quantities, e.g., by using drawings and equations with a symbol for the unknown number to represent the problem.1
Next Generation Science Standards
ETS - Engineering in the Sciences
ETS1 - Engineering Design
- 3-5-ETS1-2 - Generate and compare multiple possible solutions to a problem based on how well each is likely to meet the criteria and constraints of the problem.