Python Programming - Data Types - Discussion
Discussion Forum : Data Types - General Questions (Q.No. 41)
41.
What is the purpose of the
count()
method in Python lists?Answer: Option
Explanation:
The count()
method is used to count the number of occurrences of a specified element in a list.
Here is an example program that uses the count() method:
list = [1, 2, 3, 4, 1, 2]
print(list.count(1))
This program will print the number 2, which is the number of times the element 1 appears in the list.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers