Skip to content

Instantly share code, notes, and snippets.

/.py

Created July 16, 2017 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/25b32939e6acc0755229dd516254f292 to your computer and use it in GitHub Desktop.
Save anonymous/25b32939e6acc0755229dd516254f292 to your computer and use it in GitHub Desktop.
import sys
if len(sys.argv) != 2:
print("Error")
exit(1)
key = int(sys.argv[1])
text = input("plaintext: ")
buffer = ""
for s in text:
if s.islower():
buffer += chr(ord(( s + key - 97) % 26 + 97))
elif s.isupper():
buffer += chr(ord(( s + key - 65) % 26 + 65))
else:
buffer += s
print(buffer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment