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.
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?
‘c’ + 1
Correct answer: 2
2
3
d
Q2.
Read the program below carefully. When will the condition in the while loop become False?
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 3
When the length of the band list is 4
Q3.
Read the program below carefully. When will this while loop terminate?
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