List Slicing Help


#1



https://www.codecademy.com/courses/python-beginner-en-pwmb1/1/2?curriculum_id=4f89dab3d788890003000096#


ERROR: global name "first" is not defined


I expect to complete the lesson. the directions don't tell me to define a variable called first, middle, last


Replace this line with your code. 
suitcase = ["sunglasses", "hat", "passport", "laptop", "suit", "shoes"]



first  = suitcase[0:2] 
middle = suitcase[2:3]
last = [4:5]


#2

Your first and middle has the format: suitcase[x:y]. Why is your last different?
Also, they want the first two, middle two, and last two. Your first is correct but the middle only gives one middle item. So is your last if you added suitcase to it.


#3

OMG thank you so much! I need to stop doing that lol


#4

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