4/14 Late Arrivals and List Length help


#1

suitcase = []
suitcase.append("sunglasses")
suitcase.append("Clothes")
suitcase.append("Camera")
suitcase.append("Toothbrush")

list_length = 4 # Set this to the length of suitcase

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

Oops, try again. Remember: len(list_name) will return the length of a list as an integer.

I have no clue why this would be wrong, unless you would need to fill something in, in the top brackets??? The error message makes no sense to me because it never tells you to use the len function. Any help would be appreciated. Thanks


#2

Hi you should get the length of suitcase with

len()


#3

Thanks! I realized that I had to do list_length = len(suitcase)


#4

Help, Please!!!!! keeps giving me error!

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

Your code here!

suitecase.append("washer")
suitecase.append("tb")
suitecase.append("mn")

list_length = len(suitcase)

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

Traceback (most recent call last):
File "python", line 5, in
NameError: name 'suitecase' is not defined


#5

Hi this part

suitecase.append("washer")
suitecase.append("tb")
suitecase.append("mn")

You wrote suitecase instead of suitcase


#6

it worked! Much appreciated!!!!! thanks!


#8

lol spelling mistake :joy:


#12