PythonBuilt-inlen
input

lenBuilt-in

type

Returns the length (number of items) of an object.

Syntax

len(s)

Example

Enter values below to update the example in real time.

print
print(len("hello"))           # 5
print(len([1, 2, 3]))         # 3
print(len({"a": 1, "b": 2})) # 2