Python tuple program to count the total number of unique tuples in a list

In this python tuple program, we will count the total number of unique tuples in a list.

Steps to solve the program
  1. Take a list of tuples as input.
  2. Create a set of the given list to remove duplicate tuples using set().
  3. Now count the total number of unique tuples using len().
  4. Print the output.
				
					l =[(8,9),(4,7),(3,6),(8,9)]
print("Original list of tuples: ",l)
print("Total number of unique tuples: ",len(set(l)))
				
			

Output :

				
					Original list of tuples:  [(8, 9), (4, 7), (3, 6), (8, 9)]
Total number of unique tuples:  3
				
			

convert a binary tuple to an integer.

calculate the average of the elements in the tuple.

Leave a Comment