Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Ganesh-Chandran005 authored Dec 13, 2024
1 parent 3471c32 commit 0a5e0d3
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Day-15/GaNesh.py
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}.")

0 comments on commit 0a5e0d3

Please sign in to comment.