How do I get the Key in the dictionary that has the smallest value associated with it?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Macryc

How do I get the Key in the dictionary that has the smallest value associated with it?

:bust_in_silhouette: Reply From: zhyrin

You iterate over every key and check the associated value. If the current value is the lowest yet, you mark it as such and also store it’s associated key.
By the end of the iteration, you should have the key to the lowest value.
Before starting the iteration, you should create a variable like lowest_value and assign it a value so high that you expect every value in the dictionary to be lower. Also a lowest key.
These will be the variables you check against in the iteration, and these will hold your end result.