List Slicing tutorial bugging me out... :/


Hey guys,
Maybe someone can help me with an issue I am having in one of the tutorials
Any ideas welcome!!

As far as I can tell the code is good, but i still get the error message saying "Oops, try again. It looks like your middle slice is ["passport"] instead of ["passport", "laptop"]."

Looks to me like the something in the environment may be ignoring the second index in the list 'middle'.
I'm guessing 'suitcase[2:3]' is the correct way of slicing the middle 2 values in the list suitcase.

suitcase = ["sunglasses", "hat", "passport", "laptop", "suit", "shoes"]

first  = suitcase[0:2]  # The first and second items (index zero and one)
middle = suitcase[2:3]               # Third and fourth items (index two and three)
last   = suitcase[4:5]                # The last two items (index four and five)


[included first index : excluded last index]

middle = suitcase[2:4]

last = suitcase[4:6]

# or

last = suitcase[4:]


Wow... I guess the bug was in my brain...
thanks for clearing that up for me!


We can use negative indices as well...

>>> suitcase[-2:]
['suit', 'shoes']


Good to know...