Stuck on Late arrivals & List Length, please help!


#1



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


I have! ---> Oops, try again. Did you remember to assign a value to list_length?

why is this wrong?

suitcase = ['T-shirt', 'sun-cream', 'swimming-trunks'] 
suitcase.append('sunglasses')

# Your code here!
'T-shirt' = 1
'sun-cream' = 2
'swimming-trunks' = 3
'sunglasses' = 4
list_length = sunglasses # Set this to the length of suitcase

print "There are %d items in the suitcase." % (list_length)
print suitcase


#2

your code doesn't make any sense.

'T-shirt' = 1
'sun-cream' = 2
'swimming-trunks' = 3
'sunglasses' = 4

what are trying to do here?can i know?
and this line

list_length = sunglasses

what is sunglasses?is string or variable?why do you want to add this?what are you told to do?
instruction:

On lines 5, 6, and 7, append three more items to the suitcase list, just like the second line of the example above.

so simply use append method
and second

Then, set list_length equal to the length of the suitcase list.

so you have to set list_length to the length of suitcase.


#3

aah, whanks, don't know why i put the

'T-shirt' = 1
'sun-cream' = 2
'swimming-trunks' = 3
'sunglasses' = 4

getting desperate


#4

this is my code so far

suitcase = []
suitcase.append("sunglasses")

suitcase.append('T-shirt')
suitcase.append('swim_shorts')
suitcase.append('sun-cream')

list_length = 3 # Set this to the length of suitcase

print "There are %d items in the suitcase." % (list_length)
print suitcase


#5

wouldn't you have it like this?

suitcase = ['T-shirt', 'swim shorts', 'sun-cream']
suitcase.append("sunglasses")

list_length = 3 # Set this to the length of suitcase

print "There are %d items in the suitcase." % (list_length)
print suitcase


#6

sorry for spamming your notifs, but I did it! ---->
suitcase = []
suitcase.append("sunglasses")

suitcase.append('T-shirt')
suitcase.append('swim_shorts')
suitcase.append('sun-cream')

list_length = 4 # Set this to the length of suitcase
len(suitcase)
print "There are %d items in the suitcase." % (list_length)
print suitcase


#7

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