Test Index

Python Revision Tour Get it on Google PlayDownload on the App Store CBSE Board Videos

© examsnet.com
Question : 99 of 102
Marks: +1, -0
Which of the following functions is a valid built-in function for both list and dictionary datatype ?
[CBSE 2023 Compartment]
Solution:  
Concept:
len() is a built-in function that works on any collection: string, list, tuple, dictionary, set.
Explanation:
len([1, 2, 3]) = 3 and len({1: 'a', 2: 'b'}) = 2.
items(), update() and values() are dictionary methods; a list has none of them.
Answer:
Option B (len())
© examsnet.com
Advertisements
Go to Question: