Professional Documents
Culture Documents
L2 Python For Loops Intro
L2 Python For Loops Intro
Decomposi
tion
Abstractio
n
Algorithmi
c thinking
Decomposition
Decomposition means breaking a
complex problem down into smaller,
more manageable parts.
Dealing with many different stages
of a problem at once is much more
difficult than breaking it down into a
number of smaller problems and
solving them one at time.
Learning objectives (L1-4)
● Understand what the three basic programming constructs are and how they
are used to control the flow of a program.
for variable
in : list for loops are convenient for iterating over
block of
statements
the items of a list
1
4
3
6
Iterating over a list of dice rolls
selection
Iterating over a list of dice rolls: Walkthrough
selection
Iterating over a list of dice rolls: Walkthrough
selection
Iterating over a list of dice rolls: Walkthrough
selection
0 4
Iterating over a list of dice rolls: Walkthrough
selection
0 4
Iterating over a list of dice rolls: Walkthrough
selection
0 4
Iterating over a list of dice rolls: Walkthrough
selection
0 4
1 6
Iterating over a list of dice rolls: Walkthrough
selection
0 4
1 6
Task:
You need to complete:
• For Loops Worksheet 1
• Save it to your year 9 computing folder.
Answers
1. Numbers = []
2. for i in range(1000):
3. Numbers.append(i)
4. check = len(Numbers)
5. print("There are", check, "Numbers in your list")
2. Numbers = []
3. for i in range(ListSize):
4. Numbers.append(i)
5. check = len(Numbers)
6. print("There are", check, "Numbers in your list")