Created
June 8, 2024 05:56
-
-
Save lw13377/eac1439b264cb0391f1cc536207e829b to your computer and use it in GitHub Desktop.
lesson 11 homework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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