I noticed that when working with a ciphertext of odd numbers we receive an error with the rail_fence_cipher_decrypt.py file. I copied your code from this github, but could be missing something.
For a reproducible example you could update line 22 to:
ciphertext = HLOEL
Running rail_fence_cipher_decrypt.py should output Hello but instead we get an error due to attempting touse .lower() on a NoneType object (due to the itertools.zip_longest adding a None in the odd situation).
Do you get the same error? I am guessing a solution could be to add some logic to skip past Nonetype.
I put together a little solution that is working, but would be curious of a better approach. Overview: If r2 is None, then I overwrite the value with a letter and also update variable "odd" to be True. Then, changed your logic test to be a test where if odd = true then run the .pop() on the plaintext to remove the arbitrary letter.
This allows me to get a plaintext output of Hello, but again curious if there are better approaches! Still loving the book, had to slow down a bit due to work but learning a bunch!
I noticed that when working with a ciphertext of odd numbers we receive an error with the rail_fence_cipher_decrypt.py file. I copied your code from this github, but could be missing something.
For a reproducible example you could update line 22 to:
ciphertext = HLOEL
Running rail_fence_cipher_decrypt.py should output
Hello
but instead we get an error due to attempting touse .lower() on aNoneType
object (due to the itertools.zip_longest adding a None in the odd situation).Do you get the same error? I am guessing a solution could be to add some logic to skip past Nonetype.
I put together a little solution that is working, but would be curious of a better approach. Overview: If r2 is None, then I overwrite the value with a letter and also update variable "odd" to be True. Then, changed your logic test to be a test where if odd = true then run the .pop() on the plaintext to remove the arbitrary letter.
This allows me to get a plaintext output of
Hello
, but again curious if there are better approaches! Still loving the book, had to slow down a bit due to work but learning a bunch!