4. Late Arrivals & List Length


#1
  1. Late Arrivals & List Length .... HELP :slight_smile:

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

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

suitcase.append(%d, %d, %d) % ("lube","hat","cheese")
print len(suitcase)
print suitcase[1,2,3,4]

list_length = len(suitcase)

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

I thought this would work, however I'm getting:

File "python", line 5
suitcase.append(%d, %d, %d) % ("lube","hat","cheese")
^
SyntaxError: invalid syntax

why is it an invalid syntax....

<


#2

Hello

If you look at suitcase.append("sunglasses").
You need to repeat that 3 times, with your items.
suitcase.append(%d, %d, %d) % ("lube","hat","cheese") - This looks like one big item.

Also you have a duplicate print.

print len(suitcase)
print suitcase[1,2,3,4]
&
print "There are %d items in the suitcase." % (list_length)
print suitcase

One of them is correct.

Try what I have suggested and if you get stuck again, I will help you further.


#3

that was a big help carl1n :slight_smile: thanks :smiley:


#4