Python string length | len() method Example

len() is a built-in function in python. You can use the len() to get the length of the given string, array, list, tuple, dictionary, etc.

You can use len function to optimize the performance of the program. The number of elements stored in the object is never calculated, so len helps provide the number of elements.