0
How does this work?
l = list((1,2,3,4,5)) print(l[1:3]+l[4:2]) Gives [2,3] But how?
4 Answers
+ 2
MrFantastic
It won't be an error because it is not slicing outside the index value of the list
+ 1
l[1:3] is [2,3]. l[4:2] is empty because there is no item whose order is greater equal than 4 and less than 2.
0
Got it thanks ššš
- 1
Wouldn't l[4:2] be an error?