Late Arrivals & List Length: link to exercise


#1

Question

Late Arrivals & List Length: link to exercise

Answer

We could write a number like 4 to describe the length of the suitcase list, but we’re programmers now, and that’s bad practice! The list_length variable should update with the length of our list so we don’t have to manually change it each time we add or delete an item!
To get the number of items in a list we use a familiar built-in function, len(), like this: len(list_name).


FAQ: Learn Python: Python Lists and Dictionaries - Late Arrivals & List Length