len()

say it: “LEN” /ˈlɛn/

Tells you how many items something has.

What does len() do?

len() tells you how many items something has: letters in a string, items in a list, and so on.

print(len("pizza"))           # 5
print(len(["eggs", "milk"]))  # 2

Level: Novice · More Python terms at this level

Updated