a = [1,2,3,4,5,6,7,8,9]
print(a[-1:-5])
Why output is empty list???
a = [1,2,3,4,5,6,7,8,9]
print(a[-1:-5])
Why output is empty list???
list[start:stop:step] means give me elements starting at **start**
and incrementing by **step**
until you hit **stop**
.
Code is returning the empty list as it does reach the stop value.