Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video 85 - Caesar Cipher Part 3 issue #15

Open
liamoc89 opened this issue Nov 24, 2020 · 0 comments
Open

Video 85 - Caesar Cipher Part 3 issue #15

liamoc89 opened this issue Nov 24, 2020 · 0 comments

Comments

@liamoc89
Copy link

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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant