Program excercise : Write a function that takes a dictionary with numeric values and returns the keys of the top 3 highest values.

def get_top3_values_indices(input_dict, col_range=3):
    all_values = list(set(input_dict.values()))
    all_values.sort(reverse=True)
    top_values = all_values[:col_range]
    return [k for k in input_dict.keys() if input_dict[k] in top_values]

Comments