EXTEND, PART 1: Let's add a decryption function! This function will essentially be encrypt() but in reverse!
- First, copy the entire encrypt function and paste it at the bottom of the program. Rename it to decrypt.
- Change the addition (+) to subtraction (-) on this line of code: shift_index·=·(alpha_index·+·key)·%·26
So, we'll pass encrypted_message to decrypt() as an argument. And instead of adding the key to the alphabet position, we will subtract it to find the original letter and therefore decrypt the encrypted message!
To navigate the page using the TAB key, first press ESC to exit the code editor.