Recall & Review
beginner
What does the
+ operator do when used with two lists in Python?The
+ operator joins two lists end-to-end, creating a new list with elements from both lists in order.Click to reveal answer
beginner
What is the result of
[1, 2] * 3 in Python?It repeats the list
[1, 2] three times, resulting in [1, 2, 1, 2, 1, 2].Click to reveal answer
intermediate
Can you use
+ and * operators together on lists? What happens?Yes. You can concatenate lists with
+ and then repeat the result with *. For example, ([1] + [2]) * 2 gives [1, 2, 1, 2].Click to reveal answer
beginner
Does list concatenation with
+ modify the original lists?No. The
+ operator creates a new list and does not change the original lists.Click to reveal answer
beginner
What happens if you multiply a list by zero, like
[1, 2, 3] * 0?You get an empty list
[] because repeating zero times means no elements.Click to reveal answer
What is the output of
[1, 2] + [3, 4]?✗ Incorrect
The
+ operator joins the two lists in order, so the result is [1, 2, 3, 4].What does
[0] * 5 produce?✗ Incorrect
The list
[0] is repeated 5 times, creating a list with five zeros.Which operator is used to repeat a list multiple times?
✗ Incorrect
The
* operator repeats a list the specified number of times.What is the result of
[1, 2] + [3] * 2?✗ Incorrect
The list
[3] is repeated twice to [3, 3], then concatenated to [1, 2].Does
list1 + list2 change list1?✗ Incorrect
The
+ operator creates a new list and does not change the original lists.Explain how list concatenation and repetition work in Python with examples.
Think about how you can join two groups of items or repeat a group multiple times.
You got /4 concepts.
What happens if you multiply a list by zero or a negative number? Why?
Consider how repeating something zero times means you get nothing.
You got /3 concepts.