Python Practice › Tuple Programs › Program 66

Count unique tuples

EasyTuple Programs · 66 of 70

Write a Python program to count the distinct tuples in a list.

Advertisement
Input
[(8, 9), (4, 7), (3, 6), (8, 9)]
Output
3

Approach

  1. len(set(data)).

Solution

Python
print(len(set([(8, 9), (4, 7), (3, 6), (8, 9)])))
Output
3
Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More tuple programs

← All 70 Tuple Programs