Unit 6 Lesson 8 Loops Make AP Writing Practice

Unit 6, Lesson 8 has a new writing prompt added to the activity guide help students prepare for the AP Exam. It asks the students to write how their iteration statement is used to traverse a list. The program only has one list and it is just the different icon images. This list is only used with a random number generator. It is not used with a loop anywhere. I looked at the solution file and it also doesn’t use a loop to iterate over a list. The question probably needs to be rewritten!

1 Like

In that app there are 20 images on the screen. The purpose of the loop is to loop through all the ids to modify them all within the loop instead of having 20 lines of code modifying each one individually.

Here is the code for the Shapes Button:

onEvent(“shapesButton”, “click”, function( ) {
var selectedIcon = iconsList[(randomNumber(0, iconsList.length - 1))];
for (var i = 0; i < 20; i++) {
setProperty(“icon” + i, “image”, selectedIcon);
}
});

Hi there - I am familiar with the code. The problem is that the writing prompt refers to “iterating” through a list. The images are not stored in a list. If you have not used the new Activity Guide, you would need to take a look to see what I am referring to. I am happy to have new writing practice, but the prompt is not appropriate for this lesson. Just wanted to warn other teachers who may also notice the error. Thanks

Sorry, I guess I don’t see the new Activity Guide for students. I do see the question that you are referring to on the Teacher Exemplar copy, but not the student version.

It’s probably just my mistake then. I’ll double check that I have the newest version of the student activity guide!

@jreynolds I just checked the lesson plan. You are correct that the exemplar and student handout do not match. Thank you for catching this! I’ll update the curriculum team so they can fix it.

–Michael K.

1 Like

Did anyone change this prompt to make it fit the code better?

Hi all,
I have a very smart student. 1500+ SAT. Better coder than me. He refuses to do the written responses in paragraph format and will not use sentence starters.
Do you think he would get awarded points for this written response for Unit 6 Lesson ?
This question is based on the project you submitted.

Consider an iteration statement in your program.

• Describe how this iteration statement works.

• Explain how the loop ensures that each icon (e.g., “icon0”, “icon1”, …, “icon19”) gets updated.

The loop which sets the colours of each icon is as follows:

  1. Dimensionalizes i and sets it to 0.

  2. If i is less than 20,

  3. Calculate the random size.

  4. Set the position of “icon” + String(i) to a random value. It can go off the screen by size pixels.

  5. Set the size to the computed size.

  6. Increment i.

  7. Go back to Step 2.

The literal “icon” + String(i) gets the ith icon.