Year 9

The famous for

Year 9

The famous for

warning

These resources will be removed by end of Summer Term 2025.

Switch to our new teaching resources now - designed by teachers and leading subject experts, and tested in classrooms.

Lesson details

Key learning points

  1. In this lesson, we will use a for-loop to iterate over list items. We will study a range of examples before moving on to apply what we have learnt to similar tasks.

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.
Read the program below and answer the questions. You can use the reference table at the bottom of the page to see how the index method works. What will be the output of this program?
An image in a quiz
‘c’ + 1
Correct answer: 2
3
d
Q2.
Read the program below carefully. When will the condition in the while loop become False?
An image in a quiz
When the length of the band list is 1
When the length of the band list is 2
Correct answer: When the length of the band list is 3
When the length of the band list is 4
Q3.
Read the program below carefully. When will this while loop terminate?
An image in a quiz
When band is held in the band list
When guitar has been removed from the band list
When guitar is in the band list
Correct answer: When guitar is not in the band list

3 Questions

Q1.
Read this program carefully. What will be displayed as output when this program is executed?
An image in a quiz
Buy:, item
Buy:, item, item, item, item, item
Correct answer: Buy:, Pasta, Tomatoes, Onions, Basil, Parmesan
Pasta, Tomatoes, Onions, Basil, Parmesan
Q2.
Read this program carefully. What will be displayed as output when this program is executed?
An image in a quiz
1, 2, 3, 4
1, 4, 3, 6
3
Correct answer: 4
Q3.
Read this program carefully. What will be displayed as output when this program is executed?
An image in a quiz
0
1, 4, 3, 6
Correct answer: 2
count