-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3471c32
commit 0a5e0d3
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'''AUTHOR:GANESH | ||
DAY 15''' | ||
student_scores={"Otis":85, | ||
"Sui":90, | ||
"JJ":95} | ||
|
||
def calculate_average(scores): | ||
total = sum(scores.values()) | ||
count = len(scores) | ||
average = total / count if count > 0 else 0 | ||
return average | ||
|
||
average_score = calculate_average(student_scores) | ||
print("Average Score:", average_score) # Output: Average Score: 90.0 | ||
|
||
def find_highest_score(scores): | ||
highest_student = max(scores, key=scores.get) | ||
return highest_student, scores[highest_student] | ||
|
||
highest_student, highest_score = find_highest_score(student_scores) | ||
print(f"Highest Score: {highest_student} with {highest_score}") # Output: Highest Score: Diana with 92 | ||
for student in student_scores: | ||
print(f"{student}: {student_scores[student]}") | ||
|
||
for student, score in student_scores.items(): | ||
print(f"{student} has a score of {score}.") |