Program - function to sort the dictionary with respect to key.


Topic: Program - function to sort the dictionary with respect to key.

Solution

def dict_sort_with_key(test_dict: dict):
    final dict = {}
    temp = sorted(test_dict)
    for i in temp:
        final_dict[i] = test_dict[a]
    return final_dict



List all Python Programs