What is the built-in function len() for?
What is the built-in function len()
for?
a. The len() function returns information about the memory used by a given object.
b. The len() function returns the number of elements in a collection/sequence.
c. Python does not have a built-in function callled len().
d. The len() function returns a list of the attributes and methods of a given object.
1 Answers
b. The len() function returns the number of elements in a collection/sequence.
Explanation:
len(s):
Return the length (the number of items) of an object. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set).