Skip to content

Instantly share code, notes, and snippets.

@lw13377
Created June 8, 2024 05:56
Show Gist options
  • Save lw13377/eac1439b264cb0391f1cc536207e829b to your computer and use it in GitHub Desktop.
Save lw13377/eac1439b264cb0391f1cc536207e829b to your computer and use it in GitHub Desktop.
lesson 11 homework
test_scores = {
'James': 83,
'Julia': 91,
'Ryan': 90,
'Maria': 80,
'David': 79,
'Adam': 96,
'Jennifer': 97,
'Susan': 77
}
# Find the person with the highest test score and display both their name and score
def find_highest_score(scores_dict):
result = {}
maximum = 0
for name, score in scores_dict.items():
if score >= maximum:
maximum = score
result = {'name': name, 'score': score}
return result
print(find_highest_score(test_scores))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment