Source Code:
(back to article)
# Counting tuple elements my_tuple = ("apple", "banana", "cherry", "banana") count = my_tuple.count("banana") print(count) # Output: 2
Result:
Report an issue