AP CSP CodeX - PT Practice Lesson 1

PT Practice Lesson 1 Lesson Plan

PT Practice Lesson 1

Students remix the Pixels1_matrix program to meet the requirements of the Create Performance Task.

⏰ 45 min 🎯 Grades 9-12 💻 CodeSpace 🎮 CodeX 🐍 Python
View Lesson Outline
📋

Overview

Students work on computers in the CodeSpace Sandbox. This lesson is not part of a mission. Students remix the Pixels1_matrix program to meet the requirements of the Create PT, working individually or with a partner. They follow the slides to add a second list, move the code into a function, add a parameter, and use the parameter in the function. Students then brainstorm their own remix ideas in the Activity Guide and complete the wrap-up questions.

🎯 Mission Goal: Students will complete a program that meets the Create PT requirements.

🎯

Learning Targets

  • I can create and use a list in a meaningful way.
  • I can create a function with a parameter, selection and iteration.
  • I can use the parameter in an if statement.
💡

Key Concepts

  • The Create PT has specific requirements for the program students create.
  • The parameter does not have to be used in an if statement, but it should have an effect on the functionality. The easiest way to do this is to use the parameter in an if statement.
✅

Assessment Opportunities

☑️

Success Criteria

  • Create a list
  • Use the list in a loop
  • Create a function with a parameter
  • Create a function that has a loop and if statement
📁

Digital Resources

🧰

Classroom Materials

  • ▸CodeX
  • ▸USB-C cable
  • ▸Computer
🚀

Extensions & Cross-Curricular

ExtensionStudents add a second parameter to the function that changes how the pixels are displayed, such as the delay between steps, then call the function with different values and describe what changes.
ExtensionStudents add a third list to their program and call the function with it, then explain which part of the function runs for each call.
MathStudents count the rows and columns in their pixel list, predict how many times the loop in the function will run, then check their prediction with len().
Lang ArtsStudents write a short paragraph, in the style of a Create PT written response, explaining what their function does and how the parameter changes what it does.
📐

Standards

▾

CSTA Standards

The Create PT Prep unit reviews the CSTA Standards for Units 1, 2 and 3.

AP CSP Framework

CRD-2.A - Describe the purpose of a computing innovation.
CRD-2.C - Identify input(s) to a program.
CRD-2.D - Identify output(s) produced by a program.
AAP-1.D - Develop data abstraction using lists to store multiple elements.
AAP-2.H - Write conditional statements.
AAP-2.K - Write iteration statements.
AAP-2.N - Write expressions that use list indexing and list procedures.
AAP-3.A - Write statements to call procedures.
AAP-3.C - Develop procedural abstractions to manage complexity in a program by writing procedures.
📝
Preparing for the Lesson
  • Prepare the Activity Guide to give to students. It is used for notes during the lesson, brainstorming remix ideas, and the wrap-up questions.
  • Make sure students have the Pixels1_matrix program from Traversing a List #2 completed and accessible, or have the starter code ready to give them.

🧑‍🏫
Teacher Notes
  • Students complete this lesson on the computer, using the Sandbox in CodeSpace for programming. This lesson is not part of a mission.
  • Students remix the Pixels1_matrix program to meet the requirements of the Create PT.
  • The best experience will come from students modifying their own code. However, we want all students to be engaged, so you can give them the original code to remix if needed. The last version of the Pixels1_matrix program can be found in Traversing a List #2.
  • Follow the slides for instructions and guidance. Additional help is provided in the Lesson Outline below.
  • Solution code for the final remix is provided.
  • Requirements note: The function created by the student needs to have a parameter that has an effect on its functionality. This can be accomplished many ways. But students need to be able to understand how this works, and they may be asked to give two different function calls that run different parts of the function, or why it does not run different parts of the function. The wording has changed a little bit over the last couple of years. From a reader's viewpoint, the easiest way for students to be able to respond to this type of question is to use the parameter in an if statement, and for the if statement to be near the beginning of the function. All the examples in this unit will meet the requirement in this way.
🗺️

Lesson Outline

This outline gives one way to present the lesson.

🗣️Warm-up

Use a discussion strategy, like journaling, working at boards, selecting random students, or a form of think-pair-share. Slides 2-4:

  • Review the requirements for the Create Performance Task.
  • Review how the Create PT is like a remix project.
💻PT Practice 1

💻 Students can work individually or with a collaborative partner.

Important: Students will use the Pixels1_matrix program from Traversing a List #2. They need to have it completed and accessible. Alternatively, you can give students the code as a starter from the traversing lesson.

Teaching tip: Slides 5-7: Students review Pixels1_matrix. Use the Activity Guide. Students should answer the first three questions before seeing slide 7. You can show slide 7 to help them with their answers, or wait until they answer the questions and let them check their answers with the slide.
Teaching tip: Slide 8: Go over the slide and have students record their answers in the Activity Guide. As an option, you can use collaborative groups or whole class discussion with the question.
Teaching tip: Slides 9-10: Students add another list to the program. An example is shown on slide 10, but the list can be anything the student creates, as long as it is a matrix and includes the pixel information. The list does not need to be complicated, and it can be any length.
Teaching tip: Slides 11-12: These slides outline the next step. First move the code from the main program to the function. The for loop that is already there needs to be indented again, including the sleep. Then use the code in this line before deleting it: turn_pixels(pix_info[index][0], pix_info[index][1]). The final code for this step is on slide 12.
Teaching tip: Slides 13-14: These slides also go together, adding a parameter to the function and using the parameter in the code. The final code for the step is on slide 13.
Teaching tip: Slides 15-16: Final steps of the program. The yellow star on slide 15 indicates the code for the program at this point is included. It is the final code.
Teaching tip: Slide 17: Students return to the Activity Guide and brainstorm their own remix ideas. Alternatively, you can use collaborative groups or whole class discussion with the question.
Teaching tip: Slide 18: Final slide that goes over information about the program they may be asked to write about in the Create PT writing prompts. The wrap-up will start to ask potential writing prompts so students can practice their responses.
🧑‍🤝‍🧑Wrap-Up

The wrap-up reviews their programming process and gives potential writing prompts. If time permits, have students review each other's responses. Or select a couple responses and anonymously display them with the class and discuss if the response answers the question.

✅ Formative assessment:

  • Daily reflection or journal entry
  • Wrap-up questions
  • Completed program
  • Exit ticket
  • Optional - pull a writing prompt from the Create PT Writing Prompts and have students write about their code