Lesson 2.03: Booleans & Expressions
Learning Objectives
Students will be able to...
- Define and identify: boolean, expression, composition, True, False
- Evaluate a boolean expression
- Compose boolean expressions using
and
,or
,not
,<
,>
, and==
Materials/Preparation
- Do Now
- Lab - Can I or Can't I?
- Associated Reading - section 2.2 of Book
- Read through the do now, lesson, and lab so that you are familiar with the requirements and can assist students.
Pacing Guide
Duration | Description |
---|---|
5 Minutes | Do Now |
10 Minutes | Lesson |
35 Minutes | Lab |
5 Minutes | Debrief |
Instructor's Notes
- Do Now
- Project the Do Now on the board, circulate around the class to check that students are working and understand the instructions.
- Lesson
- After 5 minutes, ask students to recall what a boolean is and how they used booleans in Snap!
- Ask students what values they saw in part 1 of the Do Now (answer should be
True
orFalse
) - Boolean expression: is an expression that evaluates to either true or false.
- Ask students what values they saw in part 1 of the Do Now (answer should be
- Ask Students about the difference between
=
and==
.- = is for assignment of value
- == builds a boolean expression and is a way to compare two values
- Remind students of boolean expressions in Snap!
- Ask the students to recall what
and
,or
andnot
did.
- Ask the students to recall what
- Give students additional time to finish completing part 2 of the Do Now, if needed.
- Have a student write up the expression they used to update the
can_get_license
code.- Poll students - how many boolean expressions are used? Answers here may vary depending on the students' code.
- Define composition: Using an expression as part of a larger expression, or a statement as part of a larger statement. You can use parentheses to compose expressions as well.
- Parentheses: In Snap! to compose many expressions they were nested together by simply putting blocks one after another. However, in Python if you want certain things to be evaluated together, use parentheses.
- After 5 minutes, ask students to recall what a boolean is and how they used booleans in Snap!
- Lab
- Evaluate expressions with
and
,or
, andnot
- Given written out rules, students will convert them into Boolean expressions.
- Create a large expression using variables that describes you.
- Evaluate expressions with
- Debrief
- Check student progress and completion of the lab, wrap up by taking any final questions.
Accommodation/Differentiation
If students are moving quickly, use this opportunity to go over truth tables (or ask them to research De Morgan's Law)
- Convert the following SNAP Truth Table program into Python.