Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1.  
  2.  
  3. alphabet_lower = {'а':'11', 'б':'12', 'в':'13', 'г':'14', 'д':'15','е':'16',
  4. 'ж':'21', 'з':'22', 'и':'23', 'к':'24','л':'25', 'м':'26',
  5. 'н':'31','о':'32', 'п':'33', 'р':'34', 'с':'35', 'т':'36',
  6. 'у':'41','ф':'42', 'х':'43', 'ц':'44', 'ч':'45', 'ш':'46',
  7. 'щ':'51', 'ъ':'52', 'ы':'53', 'ь':'54', 'э':'55','ю':'56',
  8. 'я':'61', ' ':'62', '.':'63'
  9. }
  10.  
  11. crypt = ''
  12. text = input('Введите текст: ')
  13. for letter in text:
  14. if letter in alphabet_lower:
  15. letter = alphabet_lower.get(letter) #возвращает значение ключа
  16. crypt += str(letter)
  17. crypt += ' '
  18. print(crypt)
  19.  
  20. temp = ''
  21. decrypt = ''
  22. for i in crypt:
  23. if i != ' ':
  24. temp += i
  25. else:
  26. for j in alphabet_lower:
  27. if alphabet_lower[j] == temp:
  28. decrypt +=j
  29. temp = ''
  30. print(decrypt)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement