Python Lists and Dictionaries - #4 - Late Arrivals and List Length


#1

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

For my code, I keep getting an error that states: "object of type 'int' has no len()."

However, I did put the string method of len() in with the code, along with the statement of list_length. What I am I doing wrong?

suitcase = ["sunglasses", "bathing suit", "t-shirt", "pants"] 
suitcase.append("sunglasses")

suitcase.append("bathing suit")
suitcase.append("t-shirt")
suitcase.append("pants")

list_length = len(4) 

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

#2

HI why not putting the suitcase inside len() on this line instead of 4

list_length = len(4)

And remove everything you put inside suitcase

suitcase = ["sunglasses", "bathing suit", "t-shirt", "pants"]

#3

Thanks! U the man! :joy:


#4

fgoidsghoidfsghshdhdrhgh


#5

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