Lesson Overview
Up until this point all the programs your students have written should run exactly the same way every time - reliable, but not very flexible. In this stage we introduce the conditional statement, code that functions differently depending on the conditions it encounters.
Teaching Summary
Getting Started
Activity: Bee: Conditionals
Extended Learning
Lesson Objectives
Students will:
- Compare values using the = operator
- Translate spoken language conditional statements into a program
- Identify when a conditional can be used to deal with unknown values
- Execute an algorithm with a conditional statement
- Solve puzzles using a combination of looped sequences and conditionals
Getting Started
Introduction
Review the Conditionals with Cards activity with your students.
- What is a conditional statement?
- When is it useful?
- What are some of the conditions you used in the Unplugged activity?
Now we're going to use conditionals with our bee to help us deal with some mysterious purple flowers. We don't know if those flowers have nectar or not, so we'll need to use conditionals to make sure that we collect nectar if it's there, but that we don't try to collect nectar from a flower that doesn't have any.
Activity
Bee: Conditionals
Extended Learning
Use these activities to enhance student learning. They can be used as outside of class activities or other enrichment.
True/False Tag
- Line students up as if to play Red Light / Green Light.
- Select one person to stand in front as the Caller.
- The Caller chooses a condition and asks everyone who meets that condition to take a step forward.
- If you have a red belt, step forward.
- If you are wearing sandals, take a step forward.
- Try switching it up by saying things like "If you are not blonde, step forward."
Nesting
- Break students up into pairs or small groups.
- Have them write if statements for playing cards on strips of paper, such as:
- If the suit is clubs
- If the color is red
- Have students create similar strips for outcomes.
- Add one point
- Subtract one point
- Once that's done, have students choose three of each type of strip and three playing cards, paying attention to the order selected.
- Using three pieces of paper, have students write three different programs using only the sets of strips that they selected, in any order.
- Encourage students to put some if statements inside other if statements.
- Now, students should run through all three programs using the cards that they drew, in the same order for each program.
- Did any two programs return the same answer?
- Did any return something different?
Connections and Background Information
PARCC / Smarter Balanced Assessment Skills
- Click / tap
- Drag and drop
- Select and drag / slide
- Select object
- Use video player
ISTE Standards (formerly NETS)
- 1.a - Apply existing knowledge to generate new ideas, products, or processes.
- 1.c - Use models and simulation to explore complex systems and issues.
- 4.b - Plan and manage activities to develop a solution or complete a project.
- 4.d - Use multiple processes and diverse perspectives to explore alternative solutions.
- 6.a - Understand and use technology systems.
- 6.c - Troubleshoot systems and applications.
- 6.d - Transfer current knowledge to learning of new technologies.
CSTA K-12 Computer Science Standards
- CL.L1:3-02. Work cooperatively and collaboratively with peers teachers, and others using technology.
- CT.L1:3-01. Use technology resources (e.g., puzzles, logical thinking programs) to solve age appropriate problems.
- CPP.L1:6-05. Construct a program as a set of step-by-step instructions to be acted out.
- CPP.L1:6-06. Implement problem solutions using a block-based visual programming language.
- CT.L1:6-01. Understand and use the basic steps in algorithmic problem-solving.
- CT.L2-01. Use the basic steps in algorithmic problem solving to design solutions.
- CT.L2-06. Describe and analyze a sequence of instructions being followed.
- CT.L2-07. Represent data in a variety of ways: text, sounds, pictures, numbers.
- CT.L2-08. Use visual representations of problem states, structures, and data.
- CT.L2-12. Use abstraction to decompose a problem into sub problems.
- CT.L2-14. Examine connections between elements of mathematics and computer science including binary numbers, logic, sets, and functions.
- CT.L3A-03. Explain how sequence, selection, iteration, and recursion are building blocks of algorithms.
Next-Gen Science Standards
- K-2-PS3-2. Use tools and materials provided to design and build a device that solves a specific problem or a solution to a specific problem.
- K-2-ETS1-1. Ask questions, make observations, and gather information about a situation people want to change to define a simple problem that can be solved through the development of a new or improved object or tool.
- 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.
Common Core Mathematical Practices
- 1. Make sense of problems and persevere in solving them.
- 2. Reason abstractly and quantitatively.
- 4. Model with mathematics
- 5. Use appropriate tools strategically.
- 6. Attend to precision.
- 7. Look for and make use of structure.
- 8. Look for and express regularity in repeated reasoning.
Common Core Math Standards
- 1.OA.1 - Use addition and subtraction within 20 to solve word problems involving situations of adding to, taking from, putting together, taking apart, and comparing, with unknowns in all positions, e.g., by using objects, drawings, and equations with a symbol for the unknown number to represent the problem.
- 2.OA.1 - Use addition and subtraction within 100 to solve one- and two-step word problems involving situations of adding to, taking from, putting together, taking apart, and comparing, with unknowns in all positions, e.g., by using drawings and equations with a symbol for the unknown number to represent the problem.
- 2.G.2 - Partition a rectangle into rows and columns of same-size squares and count to find the total number of them.
- 2.MD.5 - Use addition and subtraction within 100 to solve word problems involving lengths that are given in the same units, e.g., by using drawings (such as drawings of rulers) and equations with a symbol for the unknown number to represent the problem.
- 2.NBT.A.4 - Compare two three-digit numbers based on meanings of the hundreds, tens, and ones digits, using >, =, and < symbols to record the results of comparisons.
- 3.OA.3 - Use multiplication and division within 100 to solve word problems in situations involving equal groups, arrays, and measurement quantities.
Common Core Language Arts Standards
- SL.1.1 - Participate in collaborative conversations with diverse partners about grade 1 topics and texts with peers and adults in small and larger groups.
- L.1.6 - Use words and phrases acquired through conversations, reading and being read to, and responding to texts, including using frequently occurring conjunctions to signal simple relationships (e.g., because).
- SL.2.1 - Participate in collaborative conversations with diverse partners about grade 2 topics and texts with peers and adults in small and larger groups.
- L.2.6 - Use words and phrases acquired through conversations, reading and being read to, and responding to texts, including using adjectives and adverbs to describe (e.g., When other kids are happy that makes me happy).
- SL.3.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.
- L.3.6 - Acquire and use accurately grade-appropriate conversational, general academic, and domain-specific words and phrases, including those that signal spatial and temporal relationships.