Lesson 11: If/Else with Bee
Overview
Up until this point students have been writing code that executes exactly the same way each time it is run - reliable, but not very flexible. In this lesson, your class will begin to code with conditionals, allowing them to write code that functions differently depending on the specific conditions the program encounters.
Purpose
After being introduced to conditionals in "Conditionals with Cards," students will now practice using them in their programs. The if / else
blocks will allow for a more flexible program. The bee will only collect nectar if there is a flower or make honey if there is a honeycomb. Students will also practice and recognize a connection between if / else
blocks and while
loops in this set of puzzles.
Agenda
Preview of Online Puzzles (15 min)
Main Activity (30 min)
Wrap Up (15 min)
Extended Learning
View on Code Studio
Objectives
Students will be able to:
- Translate spoken language conditional statements into a program.
- Solve puzzles using a combination of looped sequences and conditionals.
Preparation
- Play through the lesson to find any potential problem areas for your class.
- 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 Students
- Think Spot Journal - Reflection Journal
Vocabulary
- Conditionals - Statements that only run under certain conditions.
Support
Report a Bug
Teaching Guide
Preview of Online Puzzles (15 min)
Pull up a puzzle from the esson, we recommend puzzle 9.
- Ask the class what the bee should do when it gets to the cloud.
- The bee should use a conditional to check for a flower or a honeycomb.
- Use the
if at flower / else
block. Ask the class what the bee should do if there's a flower. If there's not a flower, there will be a honeycomb. What should the bee do then?- The bee should
get nectar
if there is a flower andmake honey
if there is a honeycomb.
- The bee should
Fill in the rest of the code and press Run
. Discuss with the class why this worked.
Main Activity (30 min)
Online Puzzles
These puzzles might sprout some questions, so have the students work in pairs or implement the "Ask three before you ask me" rule (have the students ask three other peers for help before they go to the teacher.) This will spark discussions that will develop each student's understanding.
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 today's lesson make you feel?
- What conditionals did you use in your code today?
- What are some other conditionals a bee might use? Examples include:
- if there is a tree in front of me, buzz out of the way
- if my wing is hurt, rest on the ground
- if I see another bee, say "Hello!"
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?
Student Instructions
Add a second move forward
block to reach the sheep.
Student Instructions
Wood is a very important resource. Many things are made from it. Walk to the tree and use the destroy
block command to chop it down.
Student Instructions
Sheep-shearing time! Use the shear
command to gather wool from both sheep.
Student Instructions
Student Instructions
Every house starts with a wall. Build the first part of your house by putting the place
and move forward
commands inside the repeat loop.
Student Instructions
Build the rest of your house from any material you'd like. The repeat
command will come in handy.
Student Instructions
Student Instructions
Student Instructions
Student Instructions
Student Instructions
Lava is hiding beneath some of these blocks, which you'll need to cover up before moving forward. An if
command will come in handy here. Add a move forward
command in the correct place to mine these blocks.
Student Instructions
Now things are getting tricky. Mine 3 redstone, but don’t fall in the lava. Use an if
command to place cobblestone over any lava you uncover.
Student Instructions
Student Instructions
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.