Advertisement
smmac72

20

Mar 30th, 2023
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. inp = input()
  2. yearsales = {}
  3. with open("wands.csv", "r", encode="utf") as infile:
  4.     for n, line in enumerate(infile, 1):
  5.         line = line.rstrip('\n')
  6.         tempsplit = line.split(';')
  7.        
  8.         if tempsplit[0] == inp:
  9.             if (yearsales.get(year)):
  10.                 yearsales[year] += 1
  11.             else:
  12.                 yearsales[year] = 1
  13.  
  14. maxk, maxv = 0
  15. for k, v in yearsales.items():
  16.     if v > maxv:
  17.         maxv = v
  18.         maxk = k
  19. print(maxk)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement