I don't get this


#1


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

"
how do I fix this

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)


#2

Should be:

first = suitcase[0:2]
middle = suitcase[2:4]
last = suitcase[4:6]

because the final number is passed for 1, for example:
if you have [0:3] would be the item 1 to 2
(i do not know if I explain)
(sorry I do not know very well english)


#3

Thanks, I don't think this is the answer though


#4


:relaxed:
I hope helps you


#5

it is the answer, the stop value is not included, so if you want third and fourth item (index 2 and 3) you need [2:4] since the stop value (4) is not included


#6

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