-
Notifications
You must be signed in to change notification settings - Fork 631
Video 85 - Caesar Cipher Part 3 issue #15
Copy link
Copy link
Open
Description
When using the code provided in this video and even in your video itself, when you decode the text at the end (around 7:48 in the video) - the decoded text comes out as holvo.
I used print(shift_amount) within the for loop to check why this happened, and it showed this in the console:
_Type 'encode' to encrypt, type 'decode' to decrypt:
decode
Type your message:
mjqqt
Type the shift number:
5
-5
5
-5
5
-5
The decoded text is holvo
It seems as though the if statement needs to be outside of the for loop:
if cipher_direction == `"decode":
shift_amount *= -1
for letter in start_text:
position = alphabet.index(letter)
new_position = position + shift_amount
end_text += alphabet[new_position]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels