Python Tuple count() Method
Example
Return the number of times the value 5 appears in the tuple:
thistuple = (1, 3, 7, 8, 7, 5, 4, 6, 8, 5)
x = thistuple.count(5)
print(x)
Run example »
Definition and Usage
The count()
method returns the number of
times a specified value appears in the tuple.
Syntax
tuple.count(value)
Parameter Values
Parameter | Description |
---|---|
value | Required. The item to search for |