loop
Lists and list processing

Module 3 · Lists and list processing · Lesson 7 of 7

Quiz

Five questions on indexing, slicing and the list methods. Picture the cells shifting before you answer.

1

What does this give?

nums = [10, 20, 30]
nums[0]
2

What does this give?

nums = [10, 20, 30]
nums[-1]
3

What is the result?

nums = [10, 20, 30, 40]
nums[1:3]
4

What does this print?

nums = [1, 2, 3]
nums.append(4)
print(nums)
5

Which removes the last item AND hands it back to you?

That completes lists — and with them, Module 3. You can now make decisions, repeat work, and keep whole collections of data in order. That's the toolkit real programs are built from.