Skip to content

Instantly share code, notes, and snippets.

@OverlordAlex
Created October 22, 2014 18:07
Show Gist options
  • Save OverlordAlex/b11b75570dd20f537f3b to your computer and use it in GitHub Desktop.
Save OverlordAlex/b11b75570dd20f537f3b to your computer and use it in GitHub Desktop.
textout = ""
finalout = ""
lettercount = 1
count = 1
alphabet = "#abcdefghijklmopqrstuvwxyz" # blank first character, cause python starts at 0
shift = int(raw_input()) # get the shift
text = "#"+raw_input() # get the text to encrypt, once again, blank first character cause python
textout = "" # where we are going to put the result
for i in range(1, len(text)): # repeat length of text
lettercount = 1
true = 0
while (lettercount < len(alphabet) and true == 0):
if text[count] == alphabet[lettercount]:
# your problem is here, below. something wrong with the shift logic
textout += alphabet[((lettercount + shift) % len(alphabet)) ]
true = 1
lettercount += 1
count += 1
# what does this do anyways?
#if (true == 0):
# textout += text[count]
# show the result
print textout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment