# Python 201 Programming 300 Programming 201 Programming 202 Programming 301 Programming 302 JavaScript 101 Python 101 Web Development 101 Python 201 Drones 101 Augmented Reality micro:bit 101 MicroPython 101 Life Science Physical Science Earth Science Math Social Studies English

This course is part of Coding/STEAM Curriculum - Middle School Plan

Middle School Plan
\$2,600 per year

### Python 201 A deeper look at Python for intermediate or advanced coders in upper middle or high school with a focus on real-world computing problems. Request Quote

• 15 lessons
• Python
• Web
##### Course Includes
• 15 lessons
• 129 activities
• Enhanced Creativity Tools
• Automatic Assessment
• Tutorials and Reviews
• Coding Puzzles
• DIY Projects
• Quizzes
##### Prerequisites
No previous coding experience required.

## Lesson Plan

### Introduction

In this lesson, students will learn about a boolean, which is a data type that has only two possible values: True or False. Students will also combine a mix of booleans, variables, and operators as they solve puzzles in the modules.

### Vocabulary

• Logic/Boolean Expressions: A logic expression is an expression that calculates a boolean value using a mix of booleans, variables, and operators.
• Boolean: A value that is either True or False. In Python, True and False must be capitalized. Python equates True to the number 1, and False to the number 0. An empty string is considered False.
• "Equality" Operator: The "equality" operator (==) will produce a boolean value based on whether or not the left side is equal to the right side of an expression.
• "Not Equal" Operator: The "not equal" operator (!=) will produce a boolean value based on whether or not the left side is not equal to the right side of an expression.
• "is" Operator: The "is" operator produces True if the values on either side of the operator refer to the same value, usually referring to the same value in a computer's memory. Note: The == operator compares the values, while "is" compares the memory locations.
• "is not" Operator: The "is not" operator produces True if the values on either side of the operator do not refer to the same value in the computer’s memory.
• "and" Operator: The "and" operator will only produce True if the values on the left and right are both True. The "and" operator is commonly used to combine multiple mathematical comparisons (e.g, x>1 and x<10). If both the "and" and "or" operators are used in an expression, the "and" operator is evaluated first.
• "or" Operator: The "or" operator will produce True if one or both or the values in the expression is true. If both the "and" and "or" operators are used in an expression, the and operator is evaluated first.
• "not" Operator: The "not" operator is not a binary operator and only takes one value. The not operator will evaluate to True if the number to the right of the operator is False and vice versa.

### Objectives

Students will...
• Write and apply logic/boolean expressions
• Use boolean operators to compare values and expressions
• Predict the results of comparisons using math or the ASCII table

### Warm-Up(5 minutes)

• Draw a face that expresses how you feel about the Python 201 course so far. What are some questions,concerns, or doubts you or someone you know has about using Python?
• What do you do if you notice your code isn’t working as expected, but you don’t know how to fix it?
• What is the difference between the == operator and the "is" operator? (The == operator compares the values, while "is" compares the memory locations)
• What is the difference between the != operator and the "is not" operator? (The != operator compared the values, while "is not" compares the memory locations)

### Activities(35 minutes)

Facilitate as students complete the Boolean Logic modules on their own:
1. Logic (Tutorial)
• In this module, students are introduced to boolean logic.
• Emphasize that in Python, “true” and “false” are capitalized.
• Are students struggling with the “Gymnastics score” puzzle? Give a hint: Tell students that for each gymnastics move, they will need to multiply the total number of points from the move (e.g., “handspring * 2).
2. Equality Operators (Tutorial)
• In this module, students will learn about equality operators.
• Optional: Before students select the “play” button in the examples, ask them to write down whether they think the code will output to True or False.
• Optional: Ask students, “True or false: The ‘==’ operator and the ‘is’ operator are the same.” (False)
3. Inequalities (Tutorial)
• In this module, students are introduced to inequalities.
• Encourage students to create and test their own examples of inequalities. Here’s an example: print( 15 <= 10 )
• Are student struggling with the “Valid triangle” puzzle? Give a hint: Tell students that the sum of any two sides of a triangle must be greater than the length of the third side.
4. Comparing Strings (Tutorial)
• In this module, students will learn how the equality and inequality operators can be used on strings.
• Students will need to solve 3 puzzles. If they’re struggling, direct their attention to the hints and encourage students to brainstorm possible solutions with a partner.
5. And Operator (Tutorial)
• Students are introduced to the “and” operator, which produces “True” if the values on the right and left are both “True.”
• Are students struggling with the “Even two digit number” puzzle? Give a hint: Tell students that the number “n” must be an even number. Their code for this condition might look like this: n % 2 == 0
6. Or Operator (Tutorial)
• Students are introduced to the “or” operator, which produces “True” if one or both boolean values are “True.”
• Optional: Before students select the “play” button in the examples, ask them to write down what they think the code will output.
• Are students struggling with the “Even with two or odd with three” puzzle? Give a hint: Tell students to use the modulus operator (%).
7. Not Operator (Tutorial)
• Students are introduced to the “not” operator, which produces “True” if the value on the right is equivalent to “False,” and “True” otherwise.
• Are students struggling with the “Happy or not” puzzle? Give a hint: Tell students to replace the “?” in the following code: print(? and not ? and ?)
• Are students struggling with the other puzzles? Direct their attention to the “hint” button and encourage them to brainstorm possible solutions with a neighbor.
8. Quiz
• In this quiz, students will answer 6 boolean logic problems.
• In each problem, students will need to apply boolean logic with coding concepts learned in previous lessons.

### Discussion Questions/Follow-Up Activities(20 minutes)

Logic Gates
Ask students to apply boolean logic and fill in the following logic gates:  