Lesson Is Bugged List Slicing 5/14


#1

Basically the lesson is asking me to call the middle two items and last two items of the list in two different strings. So I do this -

suitcase = [“sunglasses”, “hat”, “passport”, “laptop”, “suit”, “shoes”]

The first and second items (index zero and one)

first = suitcase[0:2]

Third and fourth items (index two and three)

middle = suitcase[2:3]

The last two items (index four and five)

last = suitcase[4:5]

  • which is apparently wrong, and it wants me to type in [2:4] and [4:6]. Am I just not understanding something? Or is this just codeacademy gone wrong?

#2

This will only be the third item.

This will only be the fourth item

Remember that slices do not include the stop index.


#3

ohhhh okay, I actually just got that in the next lesson. Its almost like putting quotations around those set variables. Like for instance the next lesson wanted me to call “dog” out of - animals = “catdogfrog” - so I would have to - dog = animals[3:6] - because its calling the first letter after 3 and ends after 6.


#4

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