Build a Caesar Cipher - Step 12

Tell us what’s happening:

I’m to test the caesar function by calling it with the string ‘freeCodeCamp’ and the number 3 as the arguments, assigned the function call to variable encrypted_text
encrypted_text must be global scope; caesar(‘freeCodeCamp’, 3) must be assigned to the encrypted_text variable.
I’ve tried googling a 100 different ways, searched through every lesson trying to find the solution, but the wording must be throwing me off, I don’t understand how to fix. Would appreciate any and all help.

Your code so far

encrypted_text = ('freeCodeCamp', 3)

def caesar(text, shift): #no change from s11
    global encrypted_text
    alphabet = 'abcdefghijklmnopqrstuvwxyz' #no change from s11
    shifted_alphabet = alphabet[shift:] + alphabet[:shift] #no change from s11
    translation_table = str.maketrans(alphabet, shifted_alphabet) #no change from s11
    encrypted_text = caesar('freeCodeCamp', 3) #changed from
# text.translate(translation_table)
    return encrypted_text #no change from s11

# User Editable Region

# placing encrypted_text = caesar('freeCodeCamp', 3) does 
# nothing, if put on line 7 or leave 7 alone and put on line 10 
# it still gives the same error saying "You should assign 
# caesar('freeCodeCamp', 3) to the encrypted_text variable."

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36

Challenge Information:

Build a Caesar Cipher - Step 12

You are trying to call caesar inside the function itself to test it. Does that make sense?

No, unfortunately. I’m sure once its clicks I’m going to be very disappointed it didn’t make sense before, but I cannot wrap my head around what it is asking me to do. I’ve tried a bunch of ways that the examples through the lessons showed, along with the possible ways from google and none have worked. I don’t understand how to call the function inside it’s own function to test it?

you don’t call the function outside itself

you call the function outside the function

ILM, your comment unfortunately didn’t help it click, though I found a comment on a similar post that finally did help. Even though I had tried doing so before, I must have done something wrong because it didn’t work. Here’s the hint that did help though:

I was responding specifically to you saying “I don’t understand how to call the function inside it’s own function to test it”, which is not something you do

If you have additional questions, feel always free to ask them

1 Like