Q. What does the Python slice notation [1:3] return for a list?

A
Elements at index 1 and 3
B
Elements from index 1 to 2
C
Elements from index 1 to 3
D
The entire list
Solution:

The slice notation [1:3] returns elements from index 1 up to, but not including, index 3, so indices 1 and 2.

Entri PDF Icon

Get Question Bank

Strengthen Your Practice with our comprehensive question bank.

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!