I am a beginner in Python. I have written a code in which the name of the contestants and their scores will be stored in a dictionary. Let me call the dictionary as results
. However I have left it empty while writing the code. The keys and values are going to be added to the dictionary when the program is being run.
results={}
name=raw_input()
#some lines of code to get the score#
results[name]=score
#code#
name=raw_input()
#some lines of code to get the score#
results[name]=score
After the execution of the program, let us say results == {"john":22, "max":20}
I want to compare the scores of John and Max, and declare the person with highest score as a winner. But I wont be knowing the names of the contestants at the beginning of the program. So how can I compare the scores, and declare one of them as the winner.