0
a[start:stop] You are slicing the list from start(inclusive) to stop(exclusive!). a[0:2] -> [1,2] index 0 = 1 index 1 = 2 exclusive index 2, so this value is not in the list a[2:5] -> [3,5,8] index 2 = 3 index 3 = 5 index 4 = 8 exclusive index 5, so this value is not in the list. I hope this explains why [2:2] returns an empty list. About list slicing: https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2453/?ref=app
25th Mar 2021, 5:55 PM
Denise Roßberg
Denise Roßberg - avatar