You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]
The text was updated successfully, but these errors were encountered:
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]
The text was updated successfully, but these errors were encountered: