There are two types of Python tuple methods:
1. count() tuple method
In this tuple method in Python, the frequency of a given value in a tuple is returned.
Code:
tuple_1 = (1, 3, 7, 8, 7, 5, 4, 6, 8, 5)
x = tuple_1.count(5)
print(x)
Output:
5
2. index() tuple method
This tuple method is used to return the position of where a supplied value was discovered after searching the tuple for it.
Code:
tuple_1 = (1, 3, 7, 8, 7, 5, 4, 6, 8, 5)
x = tuple_1.index(8)
print(x)
Output:
3
Video : https://youtu.be/nlyQTx3cq9w
Quiz!
