Write a function that returns a dictionary sorted ascending by its values


Topic: Write a function that returns a dictionary sorted ascending by its values

Solution

def ascending_dict_valuesort(d:dict):
    return {key: val for key, val in sorted(d.items(), key = lambda ele: ele[1])}



List all Python Programs