Skip to Content
Learn
Python Lists and Dictionaries
Late Arrivals & List Length

A list doesn’t have to have a fixed length. You can add items to the end of a list any time you like!

letters = ['a', 'b', 'c'] letters.append('d') print len(letters) print letters
  1. In the above example, we first create a list called letters.
  2. Then, we add the string 'd' to the end of the letters list.
  3. Next, we print out 4, the length of the letters list.
  4. Finally, we print out ['a', 'b', 'c', 'd'].

Instructions

1.

On lines 5, 6, and 7, append three more items to the suitcase list, just like the second line of the example above. (Maybe bring a bathing suit?)

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

Folder Icon

Take this course for free

Already have an account?