Computer Science
Does the slice operator always produce a new list?
Python List Manipulation
39 Likes
Answer
Slice operator copies only the requested elements of the original list into a new list.
Answered By
22 Likes
Related Questions
What does each of the following expressions evaluate to? Suppose that L is the list
["These", ["are", "a", "few", "words"], "that", "we", "will", "use"].- L[1][0::2]
- "a" in L[1][0]
- L[:1] + L[1]
- L[2::2]
- L[2][2] in L[1]
What are list slices? What for can you use them?
Compare lists with strings. How are they similar and how are they different?
What do you understand by true copy of a list? How is it different from shallow copy?