SaveText.Ru

Без имени
  1. f = open('24.txt', 'r')
  2. txt = f.read().splitlines()
  3. f.close()
  4.  
  5. mink = 10000
  6. min_i = len(txt)
  7.  
  8. for x in range(len(txt)):
  9.     a = txt[x]
  10.     k_n = 0
  11.     ok = a.count("N")
  12.     if mink>ok:
  13.         mink = ok
  14.         min_i = x
  15.        
  16. uf = list("QWERTYUIOPASDFGHJKLZXCVBNM")
  17. counters=[0 for i in range(26)]
  18.  
  19. for h in txt[min_i]:
  20.     j = uf.index(h)
  21.     counters[j] += 1
  22.  
  23. for i in range(len(uf)):
  24.     print(uf[i], counters[i])

Share with your friends:

Print