Week 2 Unit 7: Self-test

Last updated: (05. April 2024)

Question 1

Which of the following statements about slicing are correct?

Note: There are 3 correct answers to this question.


The following slice looks strange but is syntactically correct: "test_list[::]"✅
A slice of a list can return a single element of the list.❌
A slice of a list can contain more elements than the original list.❌
It is possible to create slices of strings.✅
A slice of a list can return a sub-list containing a single element of the original list.✅

Question 2

What is the value of list1 after the following statements have been executed?



[2, 3, 4, 5, 6]❌
[1, 2, 3, 4, 5]❌
[2, 3, 4, 5]✅
[2, 6]❌

< Previous unit | Next unit > | Course Overview