Python Practice › Tuple Programs › Program 66
Count unique tuples
Write a Python program to count the distinct tuples in a list.
Input
[(8, 9), (4, 7), (3, 6), (8, 9)]
Output
3
Approach
len(set(data)).
Solution
print(len(set([(8, 9), (4, 7), (3, 6), (8, 9)])))Output
3
Learn the concept
New to this topic? Read the lesson, then come back.