Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import OrderedDict
- number_of_rows = int(input())
- list_of_students = []
- list_of_grades = []
- current_row = 1
- for number in range(1, number_of_rows * 2 + 1):
- information = input()
- if current_row % 2 == 0:
- list_of_grades.append(information)
- else:
- list_of_students.append(information)
- current_row += 1
- list_of_grades = [float(i) for i in list_of_grades]
- information_list = {}
- for name, grade in zip(list_of_students, list_of_grades):
- if name not in information_list:
- information_list[name] = grade
- else:
- information_list[name] = float((information_list[name] + grade) / list_of_students.count(name))
- orderDict = OrderedDict(sorted(information_list.items(), key=lambda kv: kv[1], reverse=True))
- for name in orderDict:
- grade = orderDict[name]
- if grade >= 4.50:
- print(f"{name} -> {grade:.2f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement