Write a pythom program to find Maximum value from dictionary whose key is present in the list


Topic: Write a pythom program to find Maximum value from dictionary whose key is present in the list

Solution

test_dict = {"Gfg": 4, "is" : 5, "best" : 9, 
             "for" : 11, "geeks" : 3} 
  
print("The original dictionary is : " + str(test_dict)) 
  
test_list = ["Gfg", "best", "geeks"] 
c=sorted(test_dict.values(),reverse=True)
for key,value in test_dict.items():
    if key in test_list and value in c[0:2]:
       print(key)



List all Python Programs