In a dict, I want to find all keys that have the highest value, so in this example not only key 'D', but also key 'B'. How do I do this (in the most efficient way)?
some_dict = {
'A': 2,
'B': 18,
'C': 7,
'D': 18
}
highest_keys(some_dict)
# Result should be: ['B', 'D'] or {'B': 18, 'D': 18}, both options would work
max only gives the last key with the highest value, but I need all. Thank you in advance! :)