75% found this document useful (4 votes)
5K views2 pages

CSP U5l06 Activity Guide

The document provides guidance for an activity to investigate loops. It includes 4 levels of challenges with increasing complexity: 1) The warm-up asks students to imagine tracking time for walking across their school multiple times and where a loop could be used. 2) Level 2 has students run an app that flips a coin a user-input number of times without code. 3) Level 3 adds code and has students run the coin flipping program for various numbers of flips to observe performance differences. 4) Level 4 adds multiple for loops to the code to process text boxes and demonstrates how the loop counter is used and the effects of changing loop conditions.

Uploaded by

api-524141584
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
75% found this document useful (4 votes)
5K views2 pages

CSP U5l06 Activity Guide

The document provides guidance for an activity to investigate loops. It includes 4 levels of challenges with increasing complexity: 1) The warm-up asks students to imagine tracking time for walking across their school multiple times and where a loop could be used. 2) Level 2 has students run an app that flips a coin a user-input number of times without code. 3) Level 3 adds code and has students run the coin flipping program for various numbers of flips to observe performance differences. 4) Level 4 adds multiple for loops to the code to process text boxes and demonstrates how the loop counter is used and the effects of changing loop conditions.

Uploaded by

api-524141584
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CSP U5L06 Loops Investigate Activity Guide

Warm-Up​ - Imagine you are interested in finding out how much time it takes on average to walk
from one end of your school to the next. You've decided to figure this out on your lunch break, and
are able to complete the walk 20 times. What would your algorithm look like? Where could a loop
show up?

Note: ​ You do not need to write your algorithm in a programming language. You can write it out in
English or in pseudocode. Also, do not spend too much time on this part (under 5 minutes).

____________________________________________________________
Level 2 - Run the app on Level 2 of Code Studio then answer the following questions
1. What information does the user input?
How many times the coin flips.

2. How does the app process that information?


By inserting the text of how many times the coin flips.

a. What is being repeated? Where is there an opportunity to use a loop?


The number of flips.
3. What information does the app output?
The type of coin.
____________________________________________________________
Level 3 - Run the program on Level 3, with code this time then answer the following
questions
1. Run this program for 10 coins flips, 100 coins flips, 1000 coin flips, and 10,000 coin flips.
When do you notice it taking longer? ​When you do 10,000 flips.

2. On what lines of code is the program using a loop?


4,7,12

3. Which lines of code decide how many times to flip the coin?
7,10,6,4
4. What does the ​++​ command seem to do
For example: ​tails++​.

____________________________________________________________
Level 4 - Run the program on Level 4, paying attention to the code

1. Find four different for loops in the program. What do they each do?
7,12,18,23,28 they make sure the text shows up in all the boxes.

2. Take a look at the names of the screen elements in Design Mode. Then navigate back to
the code. How is ​"text" + i​ used? How does it evaluate with each round of the loop?
The text+i input means the function is repeating the text i loop function.

3. What happens if you change the text box variable names? Try changing them from ​text0​,
text1​, etc. to ​textbox0​, ​textbox1​, etc. What do you need to change in the code for the
program to still work? ​Not going to work, not labeled properly.

4. What happens if you change the Boolean expression ​i < 5​ in the for loops? Change all the
Boolean expressions to each of these options and explain what happens:
a. i < 4
b. i < 3
c. i <= 4
5. Change it to text box

You might also like