Advertisement
fevzi02

Untitled

Oct 11th, 2020
165
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2.  
  3. A = [ ["А", "Б","В","Г","Д","Е","Ё","Ж","З","И","r"],
  4. [ "Й","К","Л","М","Н","О","П","Р","С","Т","s"],
  5. [ "У","Ф","Х","Ц","Ч","Ш","Щ","Ъ","Ы","Ь","t"],
  6. [ "Э","Ю","Я"," ","а","б","в","г","д","е","u"],
  7. [ "ё","ж","з","и","й","к","л","м","н","о","v"],
  8. [ "п","р","с","т","у","ф","х","ц","ч","ш","w"],
  9. [ "щ","ъ","ы","ь","э","ю","я","0","1","2","x"],
  10. [ "3","4","5","6","7","8","9","A","B","C","y"],
  11. [ "D","E","F","G","H","I","J","K","L","M","z"],
  12. [ "N","O","P","Q","R","S","T","U","V","W","."],
  13. [ "X","Y","Z","a","b","c","d","e","f","g",","],
  14. [ "h","i","j","k","l","m","n","o","p","q","-"]]
  15. k=0
  16. i=0
  17. j=0
  18. KORTE=()
  19. L=0
  20. K=0
  21. spisok=[]
  22. KK={}
  23. KK2={}
  24.  
  25. for i in range(len(A)):
  26.     for j in range(len(A[i])):
  27.         print(A[i][j], end=' ')
  28.     print("")
  29. print("\n")
  30.  
  31. str1=input("Введите слово - ")
  32. spisok = list(str1)
  33. length = len(spisok)
  34. print("\n")
  35.  
  36. for i in range(len(A)):
  37.     for j in range(len(A[i])):
  38.         for g in range(length):
  39.             if spisok[g]==A[i][j]:
  40.                 KK[g]=i,j
  41.     print(end="")
  42.  
  43. #print("\n",KK,end="")
  44. random.shuffle(A)
  45.  
  46. for sublist in A:
  47.     random.shuffle(sublist)
  48.  
  49. for i in range(len(A)):
  50.     for j in range(len(A[i])):
  51.         print(A[i][j], end=' ')
  52.     print("")
  53. #print(KK)
  54. list_keys = list(KK.keys())
  55. list_keys.sort()
  56. for i in list_keys:
  57.     KK2[i]=KK[i]
  58. #print("\n",KK2,"\n")
  59. """for g in range(length):
  60.    print(KK.get(g),"\n")"""
  61. print("\n-------------------------------")
  62. print("ЗАШИФРОВАННОЕ СЛОВО - ",end="")
  63. for g in range(length):
  64.     for i in range(len(A)):
  65.         for j in range(len(A[i])):
  66.             KORTE=KK2.get(g)
  67.             (L,K)=KORTE
  68.             if L==i and K==j:
  69.                 print(A[i][j],end="")
  70. print("\n-------------------------------")
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement