finding length (len())

For strings, len() gives the total length of the string, as in the number of characters. For lists (and tuples), it will not surprise you that len() returns the number of elements in the list (or tuple). Container objects found within count as a single item. Our examples below use some of the lists already defined above in previous sections.

Example

>>> len(mixup_list)
4
>>> len(mixup_list*2)
8
>>> len(mixup_list[:2])
2
>>> len(mixup_list + mixup_list)
8