-
-
Save OverlordAlex/b11b75570dd20f537f3b to your computer and use it in GitHub Desktop.
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
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