Continuing the discussion from Build a Caesar Cipher - Step 25:
I’m having the same issue -here’s my code:
def caesar(text, shift, encrypt=True):
if not isinstance(shift, int):
return 'Shift must be an integer value.'
if shift < 1 or shift > 25:
return 'Shift must be an integer between 1 and 25.'
alphabet = 'abcdefghijklmnopqrstuvwxyz'
if not encrypt:
shift = - shift
shifted_alphabet = alphabet[shift:] + alphabet[:shift]
translation_table = str.maketrans(alphabet + alphabet.upper(), shifted_alphabet + shifted_alphabet.upper())
encrypted_text = 'Pbhentr vf sbhaq va hayvxryl cynprf.'
return encrypted_text
def encrypt(text, shift):
return caesar(text, shift)
def decrypt(text, shift):
return caesar(text, shift, encrypt=False)
encrypted_text = encrypt('freeCodeCamp', 3)
decrypted_text = decrypt(encrypted_text, 13)
print(decrypted_text)
Yet I get the message:
You should assign Pbhentr vf sbhaq va hayvxryl cynprf. to encrypted_text.
I’ve done that!!! On the line above ‘return encrypted_text’.
Any help?
