Python program to extract unique values from dictionary values.

In this python dictionary program, we will extract unique values from dictionary values.

Steps to solve the program
  1. Take a dictionary in the given format as input and create an empty dictionary.
  2. Use for loop to iterate over the values in the dictionaries.
  3. Use a nested for loop to iterate the value list.
  4. If the element in the value list is not in the empty list then add that element to it using the append() function.
  5. Print the output.
				
					D1= {'sqa':[1,2,5,6],'tools':[3,8,9],'is':[2,5,0],'best':[3,6,8]}
value = []

for val in D1.values():
    for ele in val:
        if ele not in value:
            value.append(ele)
            
print(value)
				
			
				
					[1, 2, 5, 6, 3, 8, 9, 0]
				
			

show a dictionary with a maximum count of pairs.

show keys associated with values in dictionary

Leave a Comment