marvellik
def encrypt(text):
for char in text:
x = (ord(char))
print("кодированый текст - ", chr(x))
if x != 0 and x != 121 and x != 120 and x != 122:
x += 3
elif x == 121:
x = ord("b")
elif x == 120:
x = ord("a")
elif x == 122:
x = ord("c")
decrypt(x)
def decrypt(x):
print('Декодируем - ', ord(x))
if x != 0:
x -=3
str1 = chr(x)
print("расшифроная", str1)
str = input("enter str ")
encrypt(str)
Результат
enter str asd
кодированый текст - a
Traceback (most recent call last):
File “C:\Users\Nikit\documents\visual studio 2017\Projects\PythonApplication5\PythonApplication5\PythonApplication5.py”, line 22, in <module>
encrypt(str)
File “C:\Users\Nikit\documents\visual studio 2017\Projects\PythonApplication5\PythonApplication5\PythonApplication5.py”, line 13, in encrypt
decrypt(x)
File “C:\Users\Nikit\documents\visual studio 2017\Projects\PythonApplication5\PythonApplication5\PythonApplication5.py”, line 15, in decrypt
print('Декодируем - ', ord(x))
TypeError: ord() expected string of length 1, but int found
Для продолжения нажмите любую клавишу . . .
куда посмотреть, где ошибка не могу понять