What is the output of print([1, 2, 2, 3].count(2)) in Python?
print([1, 2, 2, 3].count(2))
Correct answer
D. 2
5 views
D. 2
5 views
count() returns the number of occurrences of a value.
Asked in: Python Interview Lists
https://docs.python.org/3/tutorial/datastructures.htmlNot sure why the answer is D? Ask here and get an explanation.