Lesson details

Key learning points

  1. In this lesson, we will be introduced to 'for loops'. For loops allow us to iterate through a sequence. We will find out how to create and use a for loop in this lesson.

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.
Complete the sentence. A while loop is an example of ...
Correct answer: Iteration
Selection
Sequence
Subroutines
Q2.
What will be output on the screen when this program is executed?
3,2,1
Correct answer: 3,2,1,0
4,3,2,1
There is an error in the program
Q3.
Which line of code in the program below contains a condition?
1
Correct answer: 2
3
4
5

3 Questions

Q1.
What will be the output when this program is executed?
Correct answer: 0, 1, 2, 3, 4
1, 2, 3, 4, 5
x, x, x, x, x
Q2.
When using the range() function. What is the first parameter used for? e.g. range(1, 11, 2)
The maximum value
Correct answer: The start value
The step or increment
The stop value
Q3.
When using the range() function. What is the second parameter used for? e.g. range(1, 11, 2)
The maximum value
The start value
The step or increment
Correct answer: The stop value

Lesson appears in

UnitComputing / Programming 3: Iteration

Computing