Advertisement
mbratanov

Untitled

Sep 12th, 2024
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. students_count = int(input())
  2. students_list = {}
  3. for student in range(students_count):
  4.     name, grade = tuple(input().split())
  5.     grade = float(grade)
  6.     if name not in students_list:
  7.         students_list[name] = []
  8.     students_list[name].append(grade)
  9. for key, value in students_list.items():
  10.     print(f"{key} -> " + ' '.join([f"{grade:.2f}" for grade in value]) + f" (avg: {(sum(value) / len(value)):.2f})")
  11.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement