Tell us what’s happening:
Below is my code so far:
def caesar (text, shift):
alphabet = ‘abcdefghijklmnopqrstuvwxyz’
encrypted_alphabet = alphabet[encrypt:] + alphabet[:encrypt]
translation_table = str.maketrans(alphabet, encrypted_alphabet)
encrypted_message = message.translate(translation_table)
encrypted_message = encrypted_text
encrypted_text = caesar(‘freeCodeCamp’, 3)
I am trying to render encrypted_text global and assign it to ceasar(‘freeCodeCamp’, 3)
Your code so far
def caesar(text, shift):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
shifted_alphabet = alphabet[shift:] + alphabet[:shift]
translation_table = str.maketrans(alphabet, shifted_alphabet)
encrypted_text = text.translate(translation_table)
print(encrypted_text)
# User Editable Region
def caesar (text, shift):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_alphabet = alphabet[encrypt:] + alphabet[:encrypt]
translation_table = str.maketrans(alphabet, encrypted_alphabet)
encrypted_message = message.translate(translation_table)
encrypted_message = encrypted_text
encrypted_text = caesar('freeCodeCamp', 3)
# User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0
Challenge Information:
Build a Caesar Cipher - Step 12