AP CSP Day 11 - Introduction to Functions
AP CSP Day 11 - Introduction to Functions
Course Information
- Course: AP Computer Science Principles
- Unit: Big Idea 1 - Creative Development (CRD)
- Lesson: Day 11 (50 minutes)
- Learning Objective: CRD-1.K - Use functions appropriately
Learning Objectives
Primary Goals
Students will be able to:
- Understand the concept of functions in programming
- Create programs using user-defined functions
- Test and refine function logic
- Analyze real-world scenarios that require functions
AP Exam Alignment
- Big Idea 1: Creative Development (10-13% of AP Exam)
- Essential Knowledge: CRD-1.K.1, CRD-1.K.2, CRD-1.K.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 nested control structures
- Introduce today's topic on functions
Student Activities:
- Think about: "What are some examples where we use functions in daily life?"
1.2 Function Examples Challenge (5 minutes)
Activity: "Identify the Function"
Instructions:
- Groups of 4-6 students
- Identify functions in given scenarios
- Discuss the importance of functions
Purpose: Activate thinking about functions
Core Content Instruction (20 minutes)
2.1 What are Functions? (10 minutes)
Definition (CRD-1.K.1):
A function is a named block of code designed to perform a specific task.
Key Concepts:
- Function definition: def function_name(parameters):
- Function call: function_name(arguments)
- Return values: return result
Case Study: Using functions in a simple program
- Program: Calculate the area of a rectangle
- Function structure: def calculate_area(length, width): return length * width
2.2 Types of Functions (5 minutes)
Examples:
- Built-in functions: print(), len()
- User-defined functions: def custom_function():
Discussion Questions:
- What makes a good function?
- Can you think of an example where functions are used in daily life?
- Why are functions important in programming?
2.3 Advanced Function Concepts (5 minutes)
Why is it important?:
- Reusability: Writing code once, using it multiple times
- Modularity: Breaking down problems into smaller parts
Discussion Questions:
- How can we make functions reusable?
- Why is modularity important in programming?
Hands-On Activity (15 minutes)
3.1 Group Project: Create a Program with Functions (15 minutes)
Activity: "Design a Program"
Instructions:
- Groups of 3-4 students
- Design a program that uses functions
- Test the program for correctness
- Present the program to the class
Materials:
- **Program design worksheet
- **Function usage checklist
Learning Goals:
- **Understand functions
- **Create programs using functions
- **Test function logic
- **Present ideas effectively
Assessment:
- **Group participation
- **Program quality
- **Testing thoroughness
- **Presentation clarity
Closure & Preview (5 minutes)
4.1 Key Concepts Review (2 minutes)
Today's Learning Highlights:
- ✅ Understanding the concept of functions in programming
- ✅ Creating programs using user-defined functions
- ✅ Testing and refining function logic
- ✅ Analyzing real-world scenarios that require functions
AP Exam Connection:
- These concepts will appear in AP exam multiple choice questions
- Understanding functions is crucial for the Create Performance Task
4.2 Next Class Preview (3 minutes)
Day 12 Topic: "Parameters and Return Values"
- Learning Objective: CRD-1.L - Use parameters and return values appropriately
- Activity: Practicing parameter passing and return values
- Homework: Think about a recent program you used. What functions did it employ?