List LengthΒΆ

As with strings, the function len returns the length of a list (the number of items in the list). However, since lists can have items which are themselves sequences (e.g., strings), it important to note that len only returns the top-most length.

Note that alist[0] is the string "hello", which has length 5.

Check your understanding

Next Section - Accessing Elements