Example from Codecademy:
We can do something similar when selecting the last few items of a list:
print(fruits[2:])
[‘cherry’ , ‘date’]
We can omit the final index when selecting the final elements from a list.
My code:
suitcase = [‘shirt’, ‘shirt’, ‘pants’, ‘pants’, ‘pajamas’, ‘books’]
start = suitcase[:3]
end = suitcase[2:]
print(suitcase[2:])
Feedback Codecademy:
Value for end
did not match ['pajamas', 'books']
, (was ['pants', 'pants', 'pajamas', 'books']
).
My question it’s about the “end = suitcase[2:]”. So my question is. Why do you explain it this way, but in practice it works differently. Or am I completely wrong and do I misunderstand?