Nov-04-2018, 12:04 PM
On line 23, you cannot slice character. Character is a single alpha character. By iterating over text, you are already retrieving individual characters from text. Line 23 can be rewritten as:
character = the corresponding character in shifted_alphabetI don't think enumerate() is the best way to go about this. Since you have both original and shifted, you could use zip() instead to directly connect the two:
original = string.ascii_lowercase original = deque(list(original)) shifted = original.copy() shifted.rotate(3) for char1, char2 in zip(original, shifted): print(f"{char1} to {char2}")With that in mind, I recommend using zip() to combine them and then converting the result into a dictionary. Then, you can iterate over the clear text and use each character to index the dictionary for the cipher character.