Skip to content

Tag Archives: Python dictionary-programs

Given list of strings. The task is to find the frequency of the elements which are common in all strings given in the list of… Read More
Given a dictionary, replace None values in every nesting with an empty dictionary. Input : test_dict = {“Gfg” : {1 : None, 7 : None},… Read More
Given a dictionary with integer keys. The task is to find the sum of all the keys. Examples: Input : test_dict = {3 : 4,… Read More
Given a list with dictionary keys and a dictionary, extract maximum from dictionary values, whose key is present in list. Examples: Input : test_dict =… Read More
Given a list of dictionaries, remove all dictionaries which don’t have K as a value. Examples: Input : test_list = [{“Gfg” : 4, “is” :… Read More
Given a dictionary, perform swapping of ith and jth index key’s value. Input : test_dict = {“Gfg”: 2, “is”: 4, “best”: 7, “for”: 9, “geeks”:… Read More
Given a list. The task is to convert it to a dictionary with the values as the list element and keys as the concatenation of… Read More
Given two dictionaries. The task is to merge them in such a way that the resulting dictionary contains the key from the first dictionary and… Read More
Many times, while working with Python, we can have a situation in which we require to remove the Kth key of the dictionary. This is… Read More
Given a dictionary, extract all the items that match given values in the list Example: Input : test_dict = {“Gfg” : 3, “is” : 5,… Read More
Given a dictionary list, extract all the dictionaries which have substring present in particular key. Input : [{“Gfg” : “4”, “best” : “1”}, {“Gfg” :… Read More
Given a dictionary with a values list, where the key represents frequency, compute the total occurrence of each value in values lists. Input : test_dict… Read More
Given a delimiter (denoted as delim in code) separated string, order the splits in form of dictionary. Examples: Input : test_str = 'gfg*is*best*for*geeks', delim =… Read More
Given a Matrix, convert it to a list of dictionaries by mapping similar index values. Input : test_list = [[“Gfg”, [1, 2, 3]], [“best”, [9,… Read More
Given a dictionary, extract the largest N dictionaries keys in descending order. Input : test_dict = {6 : 2, 8: 9, 3: 9, 10: 8},… Read More

Start Your Coding Journey Now!