Created
August 16, 2022 02:47
-
-
Save FranklyFuzzy/92b96af952060ff0c099d4284dcd93f8 to your computer and use it in GitHub Desktop.
second version of shift cipher. This time shift stays the same for encode or decode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
op = input('encode or decode? ') | |
text = input('what is the text: ') | |
key = input('What is the shift: ') | |
if op == 'encode': | |
for i in text: | |
uni = ord(i) | |
encode = int(uni) + int(key) | |
print(chr(encode), end='') | |
else: | |
for i in text: | |
uni = ord(i) | |
decode = int(uni) - int(key) | |
print(chr(decode), end='') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment