len()
Try it yourself →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
print(len("merhaba"))
print(len([1, 2, 3, 4]))Expected output
7 4
When to use?
Checks like whether an entered password is long enough, or whether a list is empty.