Open In App

Python Tuple count() Method

Last Updated : 23 Jul, 2025
Comments
Improve
Suggest changes
1 Like
Like
Report

In this article, we will learn about the count() method used for tuples in Python. The count() method of a Tuple returns the number of times the given element appears in the tuple.

Example

Output :

3

Python Tuple count() Method Syntax 

Syntax: tuple.count( ele )

Parameters:

  • ele: Any element whose occurrence we want to calculate.

Return: The number of times the elements appears in the tuple.

Tuple count() Method in Python Examples

Count Frequency of Element in a Tuple in Python

Here we are calculating the total occurrence of a particular element in the given tuple using the count method.

Output:

Count of 3 in Tuple1 is: 3
Count of Python in Tuple2 is: 3

Count List Elements Inside Tuple

Here we are calculating the total occurrence of a particular element, which in this case is a list and tuple inside a tuple using the count method.

Output:

Count of [3, 2] in Tuple is: 2

Count Elements that do not exist in the Tuple

Here we are calculating the total occurrence of a particular element in the given tuple using the count method that actually does not exist in the tuple.

# Creating tuples
Tuple1 = (0, 1, 2, 3, 2, 3, 1, 3, 2)
Tuple2 = ('python', 'geek', 'python',
          'for', 'GFG', 'python', 'geeks')

# count the appearance of 3
res = Tuple1.count(5)
print('Count of 5 in Tuple1 is:', res)

# count the appearance of python
res = Tuple2.count('GeeksforGeeks')
print('Count of GeeksforGeeks in Tuple2 is:', res)

Output:

Count of 5 in Tuple1 is: 0
Count of GeeksforGeeks in Tuple2 is: 0

Counting occurrences of Tuples in a Tuple

In this example, we are nesting tuples inside a tuple and we check how many times a tuple is inside a tuple is occurring.

Output :

2
0

Article Tags :
Practice Tags :

Similar Reads