Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def swap(list): #функция reverse, но ручками(
- return list[::-1]
- def ListSwap(list):
- res = []
- for i in range(len(list)):
- list[i] = swap(list[i])
- res.append(list[i])
- res = swap(res)
- return res
- alfa =' АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюяABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.,-_!?0123456789@#$%^&*()'
- print('Введите текст для шифрования: ')
- Text = input()
- SplitedText = Text.split()
- print('Введите сдвиг: ')
- res_shi = []
- res_des = []
- for i in range(len(SplitedText)):
- a = []
- for j in SplitedText[i]:
- a.append(alfa[(alfa.find(j))+(1 % (len(alfa)-1))])
- res_shi.append(''.join(a))
- print(' '.join(res_shi),)
- res_shi = ListSwap(res_shi)
- for i in range(len(res_shi)):
- a = []
- for j in res_shi[i]:
- a.append(alfa[(alfa.find(j))-(1 % (len(alfa)-1))])
- res_des.append(''.join(a))
- print(' '.join(ListSwap(res_des)))
Advertisement
Add Comment
Please, Sign In to add comment