Which special method makes len(obj) work in Python?
-
A
__size__
-
B
__length__
-
C
__count__
-
D
__len__
Correct answer
Correct answer
D. __len__
Explanation
Defining __len__ lets objects work with len().
Doubts & discussion
Not sure why the answer is D? Ask here and get an explanation.
Ask a doubt about this MCQ