Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- students = {}
- n = int(input())
- for i in range(n):
- student = input()
- grade = float(input())
- if student not in students:
- students[student] = [grade, 1]
- else:
- students[student][0] += grade
- students[student][1] += 1
- for student in students:
- students[student] = students[student][0] / students[student][1]
- new = sorted(students, key=lambda x: students[x], reverse=True)
- [print(f'{x} -> {students[x]:.2f}') for x in new if students[x] >= 4.5]
Advertisement
Add Comment
Please, Sign In to add comment