AP CSP Day 2 - Variables and Assignments
AP CSP Day 2 - Variables and Assignments
Course Information
- Course: AP Computer Science Principles
- Unit: Big Idea 1 - Creative Development (CRD)
- Lesson: Day 2 (50 minutes)
- Learning Objective: CRD-1.B - Use variables appropriately
Learning Objectives
Primary Goals
Students will be able to:
- Define what a variable is
- Understand how variables store data
- Create and use variables in programs
- Perform assignments using variables
AP Exam Alignment
- Big Idea 1: Creative Development (10-13% of AP Exam)
- Essential Knowledge: CRD-1.B.1, CRD-1.B.2, CRD-1.B.3
- Computational Thinking Practice: 1.A - Investigate the situation, context, or task
Lesson Structure (50 minutes)
Opening Hook (10 minutes)
1.1 Welcome & Lesson Preview (5 minutes)
Teacher Activities:
- Recap previous day's content on algorithms
- Introduce today's topic on variables
Student Activities:
- Think about: "What are some examples where we use variables in daily life?"
1.2 Variable Examples Challenge (5 minutes)
Activity: "Identify the Variable"
Instructions:
- Groups of 4-6 students
- Identify variables in given scenarios
- Discuss the importance of variables
Purpose: Activate thinking about variables
Core Content Instruction (20 minutes)
2.1 What are Variables? (10 minutes)
Definition (CRD-1.B.1):
A variable is a named storage location that holds a value.
Key Concepts:
- Data types: int, float, string, boolean
- Variable declaration: Declaring a variable
- Assignment: Assigning a value to a variable
Case Study: Using variables in a simple program
- Program: Calculate the area of a rectangle
- Variables: length, width, area
2.2 Examples of Variables (5 minutes)
Examples:
- Mathematical variables: x = 5, y = 10
- String variables: name = "John"
- Boolean variables: is_active = True
Discussion Questions:
- What makes a good variable name?
- Can you think of an example where variables are used in daily life?
- Why are variables important in programming?
2.3 Assignment Operations (5 minutes)
Why is it important?:
- Assignment: Storing values in variables
- Reassignment: Changing the value of a variable
- Compound assignment: +=, -=, *=, /=
Discussion Questions:
- How can we reassign a variable?
- Why is reassignment useful in programming?
Hands-On Activity (15 minutes)
3.1 Group Project: Create a Program with Variables (15 minutes)
Activity: "Design a Program"
Instructions:
- Groups of 3-4 students
- Design a program that uses variables
- Present the program to the class
Materials:
- **Program design worksheet
- **Variable usage checklist
Learning Goals:
- **Define a variable
- **Use variables in a program
- **Perform assignments
- **Present ideas effectively
Assessment:
- **Group participation
- **Program quality
- **Presentation clarity
Closure & Preview (5 minutes)
4.1 Key Concepts Review (2 minutes)
Today's Learning Highlights:
- ✅ Understanding what a variable is
- ✅ Identifying examples of variables
- ✅ Creating and using variables in programs
- ✅ Performing assignments
AP Exam Connection:
- These concepts will appear in AP exam multiple choice questions
- Understanding variables is crucial for the Create Performance Task
4.2 Next Class Preview (3 minutes)
Day 3 Topic: "Expressions and Operators"
- Learning Objective: CRD-1.C - Use expressions and operators appropriately
- Activity: Practicing expression evaluation
- Homework: Think about a recent program you used. What variables did it employ?