August 2019
Beginner
482 pages
12h 56m
English
The len function expects a collection as input and returns the length of this collection—in other words, how many elements it consists of.
We measure the length of the string object in the following code, which is also iterable—you can think of it as a collection of characters:
>>> len('Hello')5
Indeed, there are five characters in this word!