Advertisement
AlexG2230954

ДЗ. Задание 6

May 22nd, 2022
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. from collections import defaultdict
  2.  
  3.  
  4. def get_student():
  5.     *student_name, class_number, score = input().split()
  6.     return int(class_number), int(score)
  7.  
  8.  
  9. def get_mid(scores):
  10.     return sum(scores) / len(scores)
  11.  
  12.  
  13. classes = defaultdict(list)
  14.  
  15. while True:
  16.     try: class_number, score = get_student()
  17.     except EOFError: break
  18.  
  19.     classes[class_number].append(score)
  20.  
  21. print(*map(get_mid, [classes[9], classes[10], classes[11]]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement