Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1.  
  2. inp=list(input("Введите строку: ").replace(" ",""))
  3. statistic = sorted([(i, inp.count(i)) for i in set(inp)], key=lambda x: x[1])
  4. shift_val = int(input("Введите сдвиг: "))
  5. shift = [ (chr(i), chr((i+shift_val)) if (i+shift_val<=ord("z")) else chr(ord("a")+(i+shift_val)%ord("z")-1)) for i in range(ord("a"), ord("z")+1)]
  6. print(statistic)
  7. print(shift)
  8. print(list(map(lambda x: (shift[ord(x[0])-ord("a")][1], x[1]), statistic)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement