Day 3 - Expressions and Operators
Day 3: Expressions and Operators
Learning Objectives
- AAP-1.D: For data abstraction: Develop data abstraction using lists to store multiple elements.
- AAP-2.B: Represent a step-by-step algorithmic process using sequential code statements.
- AAP-2.C: Evaluate expressions that use arithmetic operators.
Essential Questions
- How are expressions evaluated in a program?
- How do operators allow us to manipulate data in meaningful ways?
Materials Needed
- Presentation slides on expressions and operators
- Programming environment
- Expression evaluation worksheet
- Debugging exercise handouts
- Exit ticket templates
Vocabulary
- Expression
- Operator
- Arithmetic operator
- Operand
- Evaluation
- Order of operations
- Precedence
- Syntax error
Procedure (50 minutes)
Opening (8 minutes)
-
Review and Connection (3 minutes)
- Review variables and assignments from previous lesson
- Connect to today's focus on expressions and operators
-
Warm-up Activity (5 minutes)
- Display several arithmetic expressions and ask students to evaluate them
- Discuss how order of operations applies in programming
Main Activities (32 minutes)
-
Lecture: Arithmetic, Relational, and Logical Operators (12 minutes)
- Define expressions as combinations of values, variables, operators, and procedure calls
- Explain that expressions are evaluated to produce a single value
- Introduce arithmetic operators:
- Addition (+)
- Subtraction (-)
- Multiplication (*)
- Division (/)
- Modulus (MOD)
- Demonstrate how each operator works with examples
- Explain order of operations and precedence rules
- Briefly introduce relational operators (=, ≠, >, <, ≥, ≤) and logical operators (AND, OR, NOT)
- Show how operators can be combined in complex expressions
-
Demo: Order of Operations in Expressions (8 minutes)
- Walk through the step-by-step evaluation of complex expressions
- Show how parentheses can be used to control evaluation order
- Demonstrate common mistakes in expression writing
- Show how the same expression can be written in different ways
- Compare mathematical notation with programming notation
-
Hands-on: Writing and Evaluating Expressions (12 minutes)
- Students work in the programming environment
- Guide students through writing expressions with different operators
- Have students predict the result of expressions before running them
- Include exercises with variables in expressions
- Challenge students to write expressions for specific scenarios (e.g., converting temperatures, calculating averages)
Closing (10 minutes)
-
Activity: Debugging Expressions with Syntax Errors (5 minutes)
- Provide students with expressions containing common errors
- Students identify and fix the errors
- Discuss common mistakes and how to avoid them
- Emphasize the importance of careful syntax in expressions
-
Exit Ticket and Preview (5 minutes)
- Students write and evaluate expressions with multiple operators
- Preview that next class will focus on strings and string operations
Assessment
- Formative: Participation in hands-on activities and debugging exercises
- Exit Ticket: Accuracy of expression writing and evaluation
Differentiation
For Advanced Students
- Provide more complex expressions to evaluate
- Introduce additional operators or functions
- Challenge them to create expressions that solve real-world problems
For Struggling Students
- Provide step-by-step evaluation guides
- Focus on simpler expressions with fewer operators
- Use visual aids to illustrate order of operations
Homework/Extension
- Complete a worksheet with expression evaluation exercises
- Create a calculator program that uses expressions to perform calculations
- Research how different programming languages handle division and modulus
Teacher Notes
- Emphasize that expressions always evaluate to a single value
- Watch for confusion about division (/ in programming often performs floating-point division)
- Make connections to mathematical concepts students already know
- Consider using physical manipulatives to demonstrate expression evaluation
- Remind students that understanding expressions is essential for writing effective programs