Write a Python program to demonstrate working of Extract Unique values dictionary values


Topic: Write a Python program to demonstrate working of Extract Unique values dictionary values

Solution

test_dict = {'gfg' : [5, 6, 7, 8], 
            'is' : [10, 11, 7, 5], 
            'best' : [6, 12, 10, 8], 
            'for' : [1, 2, 5]} 
print(f"The original dictionary is : {test_dict}")
res = sorted({ele for val in test_dict.values() for ele in val})
print(f"The unique values list is : {res}")



List all Python Programs