What is "len"? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

What is "len"?

Excuse me, I'm new of programming and can't know more. Can you tell me, what is "len" in Phyton? Is it a function or something else?

28th Feb 2020, 12:11 PM
беда с башкой
беда с башкой - avatar
3 Réponses
+ 2
Thank you everyone who answered) Len is really cool💪
28th Feb 2020, 7:24 PM
беда с башкой
беда с башкой - avatar
+ 1
This is a function which tells you the length of a variable you give if it's a list so how many elements there are etc.
28th Feb 2020, 12:12 PM
Eliya Ben Baruch
Eliya Ben Baruch - avatar
+ 1
I think len is very cool as it can be used for maybe all builtin iterables. You can use: len(list) len(str) len(range) len(dict) And they all give the expected output. In Java the way to get a size of an iterable can change, strings use length method: String.length() While arrays use length propery: array.length ArrayLists might also have third way to get the array length.
28th Feb 2020, 2:18 PM
Seb TheS
Seb TheS - avatar