I tried that but it didn't work. I changed my code so it looks like this:
message = ["thisisatest yep", "this is in fact a test", "a very
important test"]
final_message = ""
shifts = [1,2,3,4,5,]
i = 0
for words in message:
iteration = 0
for letter in words:
if letter.isalpha():
iteration = iteration % len(shifts)
a = ord(letter)+int(shifts[iteration])
if a>122:
a-=26
if a<65:
a+=26
final_message = final_message + chr(a)
iteration +=1
print (final_message)
Here is what is going wrong:
I have the word" hokie" inserted in beginning middle and end of each line. so first line begines with hokieThough
. Then, when encrypted with (1,2,3,4,5). It should change to iqnmjUj
. Instead, I am getting iqnmjui
. Something is going wrong with my code. I had to keep loop around for capital and lowercase letters so my code looks like this now: http://imgur.com/a/IYKUQ
Do you know whats going on?