Section 7.4
Coding Task
Learning Goals
Students will gain experience writing code in the agnostic language of AP CSP
Objectives and Description
The objective of this lesson is to provide students with exposure to the agnostic coding language used in the AP CSP exam through a coding task. Additionally, this task is meant to prepare students for the first sprint of their ARC Challenge.
Activities
Activity 7.4.1 (30 minutes)
Students should be provided with a copy of the AP CSP exam reference sheet
Students should follow the prompt asking to write a script that does the following:
define a variable named songs with a blank string "" assigned to it
define a variable named numSongs that is initialized to 0
write code utilizing a REPEAT block that produces the following string assigned to the variable songs:
"song1 and song2 and song3 and song4 and song5"
this REPEAT block should also keep track of the total number of songs by adding to the numSongs variable
for each iteration of the REPEAT block, print out how many songs are currently added to the string
prints out the length of songs
Teachers can use this answer key for this activity.