andewK

Untitled

May 12th, 2021
615
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from pprint import pprint as p
  2. file = open('input.txt')
  3. lines = list(map(list, file.readlines()))
  4.  
  5. sep = [[]]
  6. for x in lines:
  7.     if x[0] == '\n':
  8.         sep.append([])
  9.     sep[len(sep)-1] += (x[:-1] + [" "])
  10.  
  11. people = []
  12. for x in sep:
  13.     d = dict()
  14.     for h in "".join(x).split():
  15.         if h[:3] != 'cid':
  16.             d[h[:3]] = h[4:]
  17.     people += [d]
  18.  
  19. count = 0
  20. for x in people:
  21.     print(x, len(x))
  22.     count += (len(x) == 7)
  23.  
  24.  
  25. print(count)
RAW Paste Data