Programming 1A Lesson Plan
Lesson: Conditional Logic
Time: 85+ mins
Students use loops and pattern recognition to help Gus the astronaut jump over obstacles. In "Module 3: Using Conditions," students are introduced to "if" statements.
Tynker Blocks Introduced
: If the condition is true, then run the code inside the block. : If the condition is true, then run the code inside the "if" case. Otherwise, run the code inside the "else" case.
- Condition: A logical expression that evaluates to true or false
- Conditional loop: A loop that performs an action if a certain condition is met
- Identify conditions
- Solve puzzles using conditional logic and loops
- Computers (1 per student) with student account access to Tynker.com
Warm-Up (25 minutes)
- Draw this chart on the classroom board:
- Ask, "If you hear the fire alarm, then what should you do?" (line up at the front of the door). Say, "Correct! If you hear a fire alarm, then line up at the front of the door." Write down the answer underneath the "then" column.
- Ask "If you have a question in class, then what should you do?" (raise your hand). Say, "Correct! If you have a question in class, then you raise your hand. "Write down the answer underneath the "then" column.
- Add more rows and fill in the chart with more everyday examples:
- If your shoelace is untied, then what do you do? (tie your shoe)
- If you need to sharpen your pencil, then what do you do? (use a pencil sharpener)
- If you fall on your knee and get a bad scrape, then what do you do? (tell the teacher)
- Continue connecting conditions and responses with arrows.
- Explain that we've been creating if statements. An if statement tells us what to do if something (a condition) is true. For example, "If you hear the fire alarm, then line up" is a conditional statement.
- Say, "Computers need to be programmed, or told, to act this way. We program computers to react to things using 'if' statements."
- Encourage students to work with a partner and think of more "if" statement examples. Discuss.
Activities (40 minutes)
1. Detect the Pattern (Puzzle)
- Students can solve this puzzle by placing the "jump" and "walk" blocks three times, but encourage them to use the "repeat" block.
- Give a hint: Tell students that two blocks go inside the "repeat" block.
2. Two Loops (Puzzle)
- In this puzzle, students have the opportunity to discover various creative solutions. If students quickly find one solution, challenge them to create a different solution using two "repeat" blocks or a different sequence of steps.
3. Using Conditions (Puzzle)
- This puzzle introduces the "if" block, which tells Gus to check the space in front of him, and what to do if there is an alien.
- Remind students of today's warm-up activity. Say, "Gus needs instructions that tell him to react to what he sees, and we can do that by using the 'if' code block."
4. The Else Block (Puzzle)
- This puzzle introduces the "if-else" block, which has two separate possible outcomes.
- Explain that "else" is another way of saying "otherwise."
5. Do It In a Loop (Puzzle)
- This puzzle brings back the "repeat until" block, which was introduced in Lesson 3. Remind students that "repeat until" makes Gus repeat all blocks inside of it until he reaches the power cell.
- Students can solve this puzzle by placing only "walk" and "jump" blocks, but encourage them use a "repeat" and "if-else" code block.
6. Until Gus Reaches the Goal (Puzzle)
- The solution is the same as the previous puzzle, but this puzzle includes different obstacles.
Optional Activities (20 minutes each)
Conditional Logic Practice:
Draw this chart on the classroom board. As a class, fill in the blanks. Encourage students to act out the sentence as you say it out loud.
- What was the most challenging puzzle for you?
- Who can give me an example of an "if" statement? Who can give me an example of an "if-else" statement?
- What's the difference between "if" and "if-else" statements?
- CCSS-ELA: RI.1.1, RI.1.6, RI.1.10, RF.1.4, RF.1.4.A, RF.1.1, SL.1.1, SL.1.2, SL.1.3, RI.2.1, RF.2.4, RF.2.4.A, RI.2.6, SL.2.1, SL.2.2, SL.2.3
- CCSS-Math: MP.1, 1.OA.B.3, 2.OA.B.2
- CSTA: 1A-AP-08, 1A-AP-09, 1A-AP-10, 1A-AP-11, 1A-AP-14
- CS CA: K-2.AP.10, K-2.AP.12, K-2.AP.13, K-2.AP.16
- ISTE: 1.c, 1.d, 4.d, 5.c, 5.d, 7.c
Key stage 1
Pupils should be taught to:
- understand what algorithms are, how they are implemented as programs on digital devices, and that programs execute by following precise and unambiguous instructions
- create and debug simple programs
- use logical reasoning to predict the behaviour of simple programs
- use technology purposefully to create, organise, store, manipulate and retrieve digital content
- use technology safely and respectfully, keeping personal information private; identify where to go for help and support when they have concerns about content or contact on the internet or other online technologies
Key stage 2
Pupils should be taught to:
- design, write and debug programs that accomplish specific goals, including controlling or simulating physical systems; solve problems by decomposing them into smaller parts
- use logical reasoning to explain how some simple algorithms work and to detect and correct errors in algorithms and programs
- understand computer networks, including the internet; how they can provide multiple services, such as the World Wide Web, and the opportunities they offer for communication and collaboration
- use technology safely, respectfully and responsibly; recognise acceptable/unacceptable behaviour; identify a range of ways to report concerns about content and contact