In this Python list program, we will take a user input as a list and remove duplicate tuples from the list with the help of the below-given steps.
Remove duplicate tuples from list:
Steps to solve the program
- Take a list of tuples as input.
- Using for loop add the tuples from the given list to another list.
- If a tuple repeats then do not add it.
- Print the output to see the result.
#Input list
list1 = [(2, 3), (4, 6), (5, 1), (2, 3), (7, 9), (5, 1)]
list2 = []
for value in list2:
if value not in list2:
list2.append(value)
#Printing output
print(list2)
Output :
[(2, 3), (4, 6), (5, 1), (7, 9)]
Related Articles
Python program to insert an element before each element of a list.
Python program to remove the duplicate string from the list.
Python program to get the factorial of each item in the list.
Python program to get a list of Fibonacci numbers from 1 to 20.
Python program to reverse all the numbers in a given list.
Python program to get palindrome numbers from a given list.