Python Len


Len function

The len() function return the length of a sequence (string, tuple, list, range) or a collection (dictionary, set).

Examples

Example 1

>>> x = "abc, de, fgh"
>>> len(x)
12
>>> y = '12345'
>>> len(y)
5
>>> 

Example 2

>>> a = [1, 2, 3, 4]
>>> b = [5, 6, 7]
>>> c = a + b
>>> c
[1, 2, 3, 4, 5, 6, 7]
>>> len(c)
7
>>>