AP CSP CodeX - Mission 4: Display Games (Obj. 1-7)
Mission 4: Display Games (Obj. 1-7)
Students learn about variable data types, convert between integers and strings, and use display.print() to display multiple messages.
Overview
In this lesson, students learn CodeX display basics. They show and print text messages, learn that values have different data types like integer and string, and convert between the two. Students also write code to perform a calculation. In Objective 7, they use a Boolean condition in their first if/else statement. The Mission 4 Obj 1-7 Assignment lets students take notes as they go, and the Display program (through Obj. 7) is the work to turn in.
๐ฏ Mission Goal: Students will learn about variable data types and use display.print() to display multiple messages.
Learning Targets
- I can print multiple messages on the screen.
- I can convert between integers and strings.
- I can identify a variable data type.
- I can write an if:else conditional statement.
Key Concepts
- Arguments are introduced to students when calling built-in functions.
- Students write code to perform a calculation.
- Values have different data types, like integer and string.
- Indenting after a colon is very important!
Assessment Opportunities
- Mission 4 Obj 1-7 Assignment
- Display program (through Obj. 7)
- Quiz after Mission 4 Objective 6
Success Criteria
- Define and use an argument in a function call
- Understand and use variable types, converting types when needed
- Use a Boolean condition in an if..then statement
Digital Resources
- โธMission 4 Obj 1-7 Assignment
- โธCode Solutions and Assignment Answers - Teacher Dashboard > Educator Resources button
Classroom Materials
- โธCodeX
- โธUSB-C cable
- โธComputer
Real-World Applications
Extensions & Cross-Curricular
๐ค
Vocabulary
โพ
๐
New Python Code
โพ
display.show(str(number))Display a number using display.show(). It can be a literal, like
9, or a variable, like number.
display.print("went up a hill")
display.print("to fetch a pail")Display text on more than one line using display.print().
if pressed:
ย ย ย ย pixels.set(0, GREEN)
else:
ย ย ย ย pixels.set(0, RED)If/else statement (branching). Look for the colon (:) at the end of each branch, and indent the block of code for each branch. This is very important!
๐
Standards
โพ
CSTA Standards - Grades 9-10
CSTA Standards - Grades 11-12
AP CSP Framework - Algorithms and Programming
AP CSP Framework - Computational Thinking Practices
- 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.
- If you have a word wall, or another form of vocabulary presentation, prepare the new terms.
- Have the Mission Reminders slides ready to review before students start.
- Mission 4 may take a little over a class period, so it is divided up into two lessons.
- If students take longer for the objectives, consider adjusting the assignment to end in one class period, even if you stop before Obj. 7. If students take less time, you can continue in Mission 4. There are additional instructions at the end of Mission 4 for creating and using functions.
- Another suggestion for assessment is for students to keep a daily journal, or use a reflection form for students to process information they learned and reflect on questions they may still have.
- You may consider having students (or the class collectively) keep a chart of errors and the ways to fix them.
- You can also add vocabulary to a word wall and keep a document or chart of the Python code learned during each mission.
- 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.
Review with students the concepts from Mission 3: variables, RGB and pixels. If you have time, you could use the Mission 1, 2, 3 Kahoot Review, or something similar.
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 computer.
-
sleep(1)- argument is 1 -
sleep(delay)- argument is delay -
pixels.set(0, color)- arguments are 0 and color -
display.show(pics.PLANE)- argument is pics.PLANE
num and then use num in the display command. This is a possible source of confusion. They can use CodeTrek if they get frustrated. Also, they will get an error in their code. The instructions clearly state this, but if students are not reading the instructions they may think they are doing something wrong. Students should also read the Hint, which discusses the error they will get.โ The assignment is complete and ready to turn in. Both students should include their names on the document. You can decide if you want students to turn in the program up to this point, or wait until the end of Mission 4.
โ Important: Remind students to clear their CodeX.
Formative assessment:
- Daily reflection journal
- Exit ticket on data types, Boolean, or branching
- Group review on data types, Boolean, or branching