L5 Slides - Intro To Python Programming - Y8
L5 Slides - Intro To Python Programming - Y8
Making predictions
count = 3 Question .
print(count) What will this program display when it is executed?
count = count-1
A. There is no valid value for count. This will
print(count) 1 result in an error.
B. It will print 2.
2C. It will print 3.
3D. It will print 3 and then 2.
▹ 4
Starter activity
Making predictions
count = 3 Question .
print(count) What will this program display when it is executed?
count = count-1 2
print(count)
State . Output .
count 3 3
count 2 2
Objectives
● Use iteration (while statements) to allow the flow of program execution to include
loops
● Use variables as counters
Activity 1
Count
count = 3 Question .
print(count) What will this extended program display when it is
count = count-1 executed?
The previous program
print(count) ended here.
count = count-1 Use your worksheet to answer.
Then, move on to the next tasks.
print(count)
count = count-1
Activity 1
Count: walk-through
count = 3 Question .
print(count) What will this extended program display when it is
count = count-1 executed?
print(count)
State . Output .
count = count-1
print(count) count 3 3
count = count-1
count 2 2
count 1 1
count 0
Activity 1
Count: iterative
count = 3 count = 3
print(count) while count >= 1:
count = count-1 print(count)
print(count) count = count-1
count = count-1
print(count)
count = count-1
Activity 1
Count: solutions
print("Lift off!")
Activity 2