Year 9
Lesson details
Key learning points
- 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?
‘c’ + 1
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
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
3 Questions
Q1.
Read this program carefully. What will be displayed as output when this program is executed?
Buy:, item
Buy:, item, item, item, item, item
Pasta, Tomatoes, Onions, Basil, Parmesan
Q2.
Read this program carefully. What will be displayed as output when this program is executed?
1, 2, 3, 4
1, 4, 3, 6
3
Q3.
Read this program carefully. What will be displayed as output when this program is executed?
0
1, 4, 3, 6
count