Advertisement
simeonshopov

Student Grades

Apr 9th, 2020
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. #!/usr/local/bin/python3.7
  2. # -*- coding: utf-8 -*import
  3.  
  4. records = {}
  5.  
  6. for _ in range(int(input())):
  7.     (name, grade) = input().split(" ")
  8.     if name not in records:
  9.         records[name] = []
  10.     records[name].append(f'{float(grade):.2f}')
  11.  
  12. for key, value in records.items():
  13.     print(f'{key} -> {" ".join(value)} (avg: {(sum(map(float, value)) / len(value)):.2f})')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement