Python List count() method Last Updated : 27 Apr, 2025 Comments Improve Suggest changes Like Article Like Report The count() method is used to find the number of times a specific element occurs in a list. It is very useful in scenarios where we need to perform frequency analysis on the data.Let's look at a basic example of the count() method. Python a = [1, 2, 3, 1, 2, 1, 4] c = a.count(1) print(c) Output3 Explanation: a.count(1) counts the occurrences of 1 in the list, as it is occurring 3 times in the list so the output is 3.Syntaxlist_name.count(value)Prameters:list_name: The list object where we want to count an element.value: The element whose occurrences need to be counted.Return Type: it an integer value, which represents the number of times the specified element appears in the list.Examples of count() methodExample 1: Lits Containing Different DatatypesThe count() method also works well with list that have different types of data. Python a = [1, 'GfG', 3.14, 'GfG', 1, True] c1 = a.count('GfG') c2 = a.count(1) print(c1) print(c2) Output2 3 Explanation:'GfG' appears twice.1 appears twice explicitly, but True is also counted because True == 1 in Python, making the total count three.Example 2: Count occurrence of sub-list in list of ListsThe count() method does not search within nested lists and it will only count occurrences at the top level. Python a = [1, [2, 3], 1, [2, 3], 1] c = a.count([2, 3]) print(c) Output2 Explanation: The sublist [2, 3] is treated as a single element in the list. The count() method counts it twice because it appears twice as a nested list.Example 3: Counting Word Frequency in a ListThis example simulates word analysis in a sentence by counting how often a word appears. Python s = "python is easy to learn and python is powerful".split() c1 = s.count("python") c2 = s.count("is") print(c1) print(c2) Outputcount of python: 2 count of is: 2 Explanation:.split() method splits the string into a list of words.We use count() to check how many times "python" and "is" appear.Related articles:Count occurrences of an element in a listHow to Get the Number of Elements in a Python List?Find all elements count in listFind most frequent element in a list Comment More infoAdvertise with us Next Article Python List count() method S Striver Follow Improve Article Tags : Misc Python python-list Python-Built-in-functions python-list-functions +1 More Practice Tags : Miscpythonpython-list Similar Reads Python List methods Python list methods are built-in functions that allow us to perform various operations on lists, such as adding, removing, or modifying elements. In this article, weâll explore all Python list methods with a simple example.List MethodsLet's look at different list methods in Python:append(): Adds an 3 min read Python List append() Method append() method in Python is used to add a single item to the end of list. This method modifies the original list and does not return a new list. Let's look at an example to better understand this.Pythona = [2, 5, 6, 7] # Use append() to add the element 8 to the end of the list a.append(8) print(a)O 3 min read Python List extend() Method In Python, extend() method is used to add items from one list to the end of another list. This method modifies the original list by appending all items from the given iterable. Using extend() method is easy and efficient way to merge two lists or add multiple elements at once.Letâs look at a simple 2 min read Python List index() - Find Index of Item index() method in Python is a helpful tool when you want to find the position of a specific item in a list. It works by searching through the list from the beginning and returning the index (position) of the first occurrence of the element you're looking for. Example:Pythona = ["cat", "dog", "tiger" 3 min read Python List max() Method max() function in Python is a built-in function that finds and returns the largest element from the list. Let's understand it better with an example:Pythona = [2,3,6,1,8,4,9,0] print(max(a))Output9 Syntaxmax(listname)Parameter:listname : Name of list in which we have to find the maximum value.Return 4 min read Python min() Function Python min() function returns the smallest value from a set of values or the smallest item in an iterable passed as its parameter. It's useful when you need to quickly determine the minimum value from a group of numbers or objects. For example:Pythona = [23,25,65,21,98] print(min(a)) b = ["banana", 4 min read How To Find the Length of a List in Python The length of a list refers to the number of elements in the list. There are several methods to determine the length of a list in Python. For example, consider a list l = [1, 2, 3, 4, 5], length of this list is 5 as it contains 5 elements in it. Let's explore different methods to find the length of 2 min read Python List pop() Method The pop() method is used to remove an element from a list at a specified index and return that element. If no index is provided, it will remove and return the last element by default. This method is particularly useful when we need to manipulate a list dynamically, as it directly modifies the origin 2 min read Python List remove() Method Python list remove() function removes the first occurrence of a given item from list. It make changes to the current list. It only takes one argument, element we want to remove and if that element is not present in the list, it gives ValueError.Example:Pythona = ['a', 'b', 'c'] a.remove("b") print(a 3 min read Python List Reverse() The reverse() method is an inbuilt method in Python that reverses the order of elements in a list. This method modifies the original list and does not return a new list, which makes it an efficient way to perform the reversal without unnecessary memory uses.Let's see an example to reverse a list usi 2 min read Like