
Children
Presentation
•
Computers
•
9th Grade
•
Practice Problem
•
Hard
Dawn Madden
Used 2+ times
FREE Resource
19 Slides • 9 Questions
1
CMU Unit 3.2.3:
Looping
through Group
Children
AKA Iteration
START!
2
What are children in a group?
3
Multiple Select
What names can I replace dot with and still make this code run?
i
number
#
Number
4
Multiple Select
What is dot referring to in the line:
for dot in dots.children?
referencing each circle in the group dots (in this case 5 circles)
only one of the Circles in the group dots
it is a variable
nothing- it stands for nothing
5
Open Ended
If I change the variable dot, what must I also change in the code?
6
What is iteration?
Iteration is a repetitive portion of an algorithm.
That is, it is a portion of the procedure which
runs until a certain condition is met or a certain
number of times..
We may see this in “for” or “while” loops, or in
code statements like “repeat 3 times” or “if
CAN_MOVE_RIGHT ==TRUE”
7
Why do we care about iteration?
In the AP Create task, iteration is required:
You must
●Use a loop
●The loop must contain an if statement
●The loop must be contained in a student-
created function
Hopefully, the loop will make running your
program easier (more about this later)
8
At the boards… Draw and execute.
9
Multiple Choice
What will happen as a result of this code?
10
Looping through a group
CREDITS
Start with a group
Let’s use this group
numbers = Group(
Label(1, 50, 50),
Label(2, 70,50),
Label(3, 90, 50),
Label(4, 110,50) )
Let’s change it
for numberValue in numbers.children:
numberValue.fill = 'green'
numberValue.value +=1
What will happen?
11
Multiple Choice
What would happen here?
nothing
12
Multiple Choice
What would happen here?
syntax error
13
More examples! Notice the FUNCTION!
14
Multiple Choice
What do you expect to happen in this code?
15
CMU Unit 3.3.1:
Lists
Like groups, but better
START!
16
What is a list?
A list is a way of storing multiple values in a
single variable. It may also be called an array.
numList = [ ‘one’, ‘two’, ‘three’, ‘four’, ‘five’]
The list is named numList
The elements of the list are ‘one’, ‘two’, ‘three’,
‘four’, ‘five’
17
What is an index?
When we talk about where an element is
located on a list, we talk about its index.
numList = [ ‘one’, ‘two’, ‘three’, ‘four’, ‘five’]
Index 0 1 2 3 4
So, numList[2] has the value ‘three’
In Python, the index starts at 0
On the AP Exam, the index starts at 1 (WHY????)
18
Multiple Choice
colorList = ['white', 'red', 'blue', 'green', 'purple', 'orange']
What is the value off colorList[3]?
red
blue
green
purple
19
Multiple Choice
colorList = ['white', 'purple', 'orange', 'red', 'blue', 'green', ]
What is the value of colorList [2]
whtie
purple
orange
red
20
NOTE:
In some programming languages, a list is called
an array.
We will always use the term list,
but if you ever see the word "array", it's just
a list!
21
Now you try!
●Go to the sandbox
●Create a small group
●Write a function (student created) that will do
something with the group by looping through it
●Call the function using a Mouse Event
Group
Function
MouseEvent
22
Lists on the Performance Task
The last 2 points for the CPT involves lists (or Groups) To get
these points, your project must:
●Include a list (or Group).
●The data stored in the list must be used.
●The list must be important for the program. This means
that writing the program without the list would have been
much more difficult or impossible.
You can use a Group! Copy the language you need to use into
your notes!
23
Some things we can do with lists
CREDITS
Indexing
We can get data from a list to use in a
variable, like
labelValue = numList[2]
Label (labelValue, 50, 250)
This allows for additional abstraction.
Check it out in the practice problems!
Change values
We can update list values using the
index
numList[2] = ‘twelve’
Changes the value from ‘three’ to
“twelve’
This means it is much easier to
update values in a program!
24
More things we can do (the important stuff)
CREDITS
Traversing
Traversing allows us to cycle
through values of a list.
We can use a helper variable
for the index, and just keep
adding one.
Be careful, you don’t want to
fall off the end of the list!
The mod operator %
The “mod” of a number is the
remainder when divided by another
number. Examples
5%2 = 1
17%5 = 2
This can help us avoid errors with
lists
25
Traversing a list with mod
26
A little challenge using mod
In the section “Looping Through Lists”, the function
“drawColoredCircles” loops through the list of colors.
None of the circles have borders, but I want to give the circles
pink and black borders in an alternating pattern. Can you revise
the code to draw black borders on three circles and pink
borders on the other three?
HINT: Use variables to store the index location
HINT: Use mod to change back and forth between pink and black
HINT: Don’t forget to set a border color to start with!
27
In your notes – using mod
Differences?
Similarities?
28
Slidesgo
Flaticon
Freepik
CREDITS: This presentation template was created
by Slidesgo, including icons by Flaticon, and
infographics & images by Freepik.
Thanks!
Please keep this slide for attribution.
CMU Unit 3.2.3:
Looping
through Group
Children
AKA Iteration
START!
Show answer
Auto Play
Slide 1 / 28
SLIDE
Similar Resources on Wayground
20 questions
GOOGLE APPS
Presentation
•
9th Grade
20 questions
Basic Python Review Lesson
Presentation
•
9th Grade
22 questions
Parallel and Perpendicular Lines
Presentation
•
9th Grade
22 questions
Pengenalan Hardware Komputer
Presentation
•
10th Grade
21 questions
lección 5.3 - Reflexive verbs
Presentation
•
9th Grade
21 questions
Balancing Chemical Equations
Presentation
•
9th Grade
22 questions
G9 Chap 1.3 - Methods of Science
Presentation
•
9th Grade
22 questions
Natural Selection & Speciation
Presentation
•
9th Grade
Popular Resources on Wayground
10 questions
Safety Day 2026 – Student Review
Quiz
•
9th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
12 questions
Map Skills
Quiz
•
3rd Grade
22 questions
Continents and Oceans
Quiz
•
5th Grade
15 questions
Rounding Decimals
Quiz
•
5th Grade