len() (Python)

len() is a built-in function that returns the number of items in an object — the number of characters in a string, or the number of elements in a list, tuple, set, or dictionary.

Python

Examples

Python

print(len("hello"))
print(len([1, 2, 3]))

Output:

5
3

See also

Back to the Dictionary