You are on page 1of 3

Unit 5- Lesson 6: Loops

Section 2:

Discuss: Discuss these questions with a partner and be prepared to share answers with
the class.

 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.

 On what lines of code is the program using a loop? 4,7,12

 Which lines of code decide how many times to flip the coin? 7,10,6,4

 What does the ++ command seem to do

o For example: tails++ .

Modify:

 Change the counting variable from i to j in all appropriate places. Does the
program still work correctly?

Section 3:

Discuss: Discuss these questions with a partner and be prepared to share answers with
the class.

 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.

 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.

 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.
Unit 5- Lesson 6: Loops

 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 discuss:

o i<4

o i<3

o i <= 4

Modify: Change it to text box

 Play a sound when the random button is clicked


 Change the counting variable i to a different letter. Does your program still
work?
 Add more phrases to the list

Loops Practice:
Directions: Complete 1-11. Please Replace this section with a snip of your screen with
all the green bubbles filled in. Thank you.
Unit 5- Lesson 6: Loops

You might also like