97. Problem to remove duplicate dictionaries from the list.

In this Python list program, we will take a list containing dictionaries and remove duplicate dictionaries from the list with the help of the below-given steps.

Remove duplicate dictionaries from list:

Steps to solve the program
  1. Take a list containing dictionaries as input and create an empty dictionary.
  2. Use for loop to iterate over each dictionary from the given list.
  3. Add that list to the empty list if it is not in that list.
  4. Print the list to see the output.
				
					#Input list
list1 = [{'Hello': 5},{'student': 7},{'are': 3},{'learning': 8},
         {'Python': 6},{'Its': 3},{'Language': 8},{'are':3}]
list2 = []

for value in list1:
    if value not in list2:
        list2.append(value)

#Printing output
print(list2)
				
			

Output :

				
					[{'Hello': 5}, {'student': 7}, {'are': 3}, 
{'learning': 8}, {'Python': 6}, {'Its': 3}, {'Language': 8}]
				
			

Related Articles

Python program to decode a run-length encoded given list.

Python program to round every number in a given list of numbers and print the total sum of the list.

Python Program to get the Median of all the elements from the list.

Python Program to get the Standard deviation of the list element.

Python program to convert all numbers to binary format from a given list.

Python program to convert all the numbers into Roman numbers from the given list.

 

 

 

Get length of each word and add it as dictionary

Decode a run-length encoded list

Leave a Comment