Skip to content

Instantly share code, notes, and snippets.

@abhi923
Created June 22, 2020 14:07
Show Gist options
  • Save abhi923/4bb5fb112d4c71755197ed7fd723d740 to your computer and use it in GitHub Desktop.
Save abhi923/4bb5fb112d4c71755197ed7fd723d740 to your computer and use it in GitHub Desktop.
school_class = {}
while True:
name = input("Enter the student's name (or type exit to stop): ")
if name == 'exit':
break
score = int(input("Enter the student's score (0-10): "))
if name in school_class:
school_class[name] += (score,)
else:
school_class[name] = (score,)
for name in sorted(school_class.keys()):
adding = 0
counter = 0
for score in school_class[name]:
adding += score
counter += 1
print(name, ":", adding / counter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment