List slicing


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[3:4] # The last two items (index four and five)

Oops, try again. It looks like your middle slice is ["passport"] instead of ["passport", "laptop"].

What is my mistake

Replace this line with your code.


I found my mistake

in middle = suitcase [2:4]
in last = suitcase [4:6]

vote if the answer was useful for you


It was helpful. I had the same exact mistake.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.