0

What happens in to the output of a list when the list slice is like [2:1]?

For example: some_list = [1, 2, 3,] print(some_list[2:1]) What would the output be, since the first value in the list slice is bigger than the second value?

13th Aug 2016, 3:44 AM
Andrew
2 Respuestas
0
When the list slice is used for over the range or under the range, it returns back a blank list [ ]
13th Aug 2016, 3:49 AM
Prashant Shahi
Prashant Shahi - avatar
0
would produce an exception (error) TypeError but if you wanted to do that you would have to put the third argument -1 is equal to the function range
13th Aug 2016, 3:50 AM
Smithers and more
Smithers and more - avatar