AP CSP CodeX - Mission 7: Personal Billboard (Obj. 7-9)
Mission 7: Personal Billboard (Obj. 7-9)
Students mix images, text, and colors in a list and use type() to display each one with the CodeX buttons.
Overview
Mission 7 may take a little over a class period, so it is divided into two lessons. This lesson covers Objectives 7-9. Students add a text string to their billboard list, then add a color and see the error it causes. They fix the error by using type() to check each item and display.fill() to fill the screen with a color. After Objective 9, students practice by adding colors as tuples, creating and calling functions, and programming a kill switch.
๐ฏ Mission Goal: Students will use images, text, and colors in a list to display a mood by pressing a CodeX button.
Learning Targets
- I can distinguish between string and image data types.
-
I can use
type()to check the data type of an item and handle it accordingly. - I can use existing code to create a function.
Key Concepts
-
In Python,
==is used to compare for equality. - You can check the type of a variable and deal with it accordingly.
-
The
type()function returns the data type of its argument. It can be used in the Console and in a program.
Assessment Opportunities
- Mission 7 Obj 7-9 Assignment
- Billboard program (final)
- Billboard program with functions
Success Criteria
- Mix text messages with a selection of images and color
- Use existing code to create a function
Digital Resources
- โธMission 7 Obj 7-9 Assignment
- โธCode Solutions and Assignment Answers - Teacher Dashboard > Educator Resources button
- โธMission 7 Kahoot! Review
Classroom Materials
- โธCodeX
- โธUSB-C cable
- โธComputer
Real-World Applications
Extensions & Cross-Curricular
display.fill() and compare.
๐
New Python Code
โพ
๐
Standards
โพ
CSTA Standards - Grades 9-10
CSTA Standards - Grades 11-12
AP CSP Framework
- In advance, create a class on your dashboard and have the join code ready to give your students.
- The assignment is best completed digitally. Prepare the assignment to give through your LMS.
- Students need the Billboard program from the Mission 7 Obj 1-6 lesson.
- Mission 7 may take a little over a class period, so it is divided into two lessons.
- Objective 7 introduces strings. You can spend some time on what a string is and how to create one. A string is a type of list, and list functions also work with a string.
- The code in Objective 8 will cause an error. This should happen! It is fixed in the next objective.
- Objective 9 fixes the type error. Students should click the term "error" and read about it in the Toolbox. It lists several errors that can occur in a Python program. This is good information for programming in general and the AP exam specifically.
- After Objective 9, students practice programming skills by adding colors in the form of a tuple, creating and calling functions, and programming a kill switch. Use the time you have, but if all additions aren't included, that is okay.
- An additional challenge is given for students who finish the program and have extra time. It is not required, but it is a nice feature of programming, and something they can do for the AP Create PT.
- If you have time at the end of the lesson, use the Mission 7 Kahoot! Review. All questions on the review are covered in the first 6 objectives.
- Refer to the lesson plans in the Python with CodeX Mission Pack Curriculum for additional challenges, cross-curricular suggestions, and additional information.
Lesson Outline
This outline gives the narration for one way to present the lesson.
Use a discussion strategy, like journaling, working at boards, selecting random students, or a form of think-pair-share.
Topic: Review what students have learned so far in Mission 7. You can also review what students learned about RGB colors.
Randomly group students into pairs for pair programming (or they can work individually).
Students log in to one computer. Two computers can be used if they want to have the activity guide open on one computer and CodeSpace on the other.
Students go to make.firialabs.com and should be in Mission 7 at Objective 7. Open the Billboard program.
You can decide if you want students to turn in their code at this point. The "After Objective 9" activity is optional, but it is really good practice for the Create PT. If you have class time to do it, we recommend it. If you are short on time, or if some of your students work at a slower pace, you can skip it.
- First, RGB colors. Have students add colors to their list using RGB triplets (tuples).
- Second, functions. Have students create at least one function from their program code. The easiest function to create is for displaying the item in the list. Another function could be for changing the choice. This function requires the
global choiceline of code. Both functions are similar to the extra code completed in the program for Mission 6 (Heartbeat_functions). - Third, kill switch. Students learned that a break statement stops the loop. Students can add another if statement to the main program using a different button.
- Fourth, clear the display. After the while loop ends, use
display.fill(BLACK)to clear the screen.
As an added challenge for highly motivated students, see if they can create a third function that is an introduction. It will display first, and give instructions on what to do.
Example solutions are given for this activity and the challenge.
โ The assignment is complete and ready to turn in.
Use a formative assessment for the wrap-up.
Formative assessment:
- Daily reflection journal
- Mission 7 Kahoot! Review (in class or individual). All questions can be answered during Objectives 1-6.
- Exit ticket on lists or nested if statements
- Group review on lists or nested if statements