Lesson details

Key learning points

  1. In this lesson, we will learn how to use a variable as a counter within a loop.

Licence

This content is made available by Oak National Academy Limited and its partners and licensed under Oak’s terms & conditions (Collection 1), except where otherwise stated.

Loading...

3 Questions

Q1.
When this program is executed, what will be displayed on the screen?
13, zero
13, zero, 0
Nothing will be displayed on the screen.
Correct answer: There is an error in the program because when line 1 is executed, variable number has not been assigned a value.
Q2.
When this program is executed, what will be displayed on the screen?
large
Correct answer: medium
medium, large
small
Q3.
When this program is executed, what will be displayed on the screen?
large
medium
Correct answer: medium, large
small

3 Questions

Q1.
How many times will line 3 be executed?
1
Correct answer: 3
4
Infinitely (the condition in line 2 will never become False)
None (the condition in line 2 will be False the first time it is checked)
Q2.
How many times will line 3 be executed?
1
3
4
Correct answer: Infinitely (the condition in line 2 will never become False)
None (the condition in line 2 will be False the first time it is checked)
Q3.
How many times will line 3 be executed?
1
3
Correct answer: 4
Infinitely (the condition in line 2 will never become False)
None (the condition in line 2 will be False the first time it is checked)

Lesson appears in

UnitComputing / Intro to Python programming

Computing