Skip to content

Instantly share code, notes, and snippets.

@FranklyFuzzy
Created August 16, 2022 02:47
Show Gist options
  • Save FranklyFuzzy/92b96af952060ff0c099d4284dcd93f8 to your computer and use it in GitHub Desktop.
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
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