Loading

Paste #p71mc94zb

  1. import sys
  2. sys.stdout = open('results.txt', 'w')
  3.  
  4. total_score_sum = total_score_cnt = 0
  5.  
  6. for filename in sys.argv[1:]:
  7.     with open(filename) as file:
  8.         content = file.read()
  9.     content = iter(content.split())
  10.     for name in content:
  11.         l = []
  12.         for score in content:
  13.             if not score:
  14.                 break
  15.             l.append(score)
  16.         total_score_sum += sum(l) / len(l)
  17.         total_score_cnt += 1
  18.  
  19. for filename in sys.argv[1:]:
  20.     with open(filename) as file:
  21.         content = file.read()
  22.     content = iter(content.split())
  23.     for name in content:
  24.         l = []
  25.         for score in content:
  26.             if not score:
  27.                 break
  28.             l.append(score)
  29.         if sum(l) / len(l) >= total_score_sum / total_score_cnt:
  30.             print(filename, name, *l)