len()
Returns the number of characters (or elements).
Syntax
len(text)
Description
Returns how many characters a string has, or how many elements a list has.
Returns
The length (int).
Example
Loading editor…
Expected output
7 4
When to use?
Checks like whether an entered password is long enough, or whether a list is empty.