I would like an explanation of what's happening when I do the following:
mylist = [1, 2, 3, 4, 5, 6, 7, 8, 9]
print(mylist[5:3:-1])
The output is [6, 5]
but can someone explain to me why? I understand when I do something like [i:j]
with i > j
but here it's reversed. The :-1
means we reverse mylist
?