Build a Caesar Cipher - Step 12

Tell us what’s happening:

“You should have a variable named encrypted_text in the global scope.”
Im not understanding what this means

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)

# User Editable Region

    print(encrypted_text)
    return(encrypted_text)
caesar('freeCodecamp',3)



# 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/142.0.0.0 Safari/537.36

Challenge Information:

Build a Caesar Cipher - Step 12

test the caesar function by calling it with the string freeCodeCamp and the number 3 as the arguments :white_check_mark:

Assign the function call to a variable named encrypted_text. :cross_mark:

This is the function call:
caesar('freeCodecamp',3)

How would you assign that to a variable?

That’s my question in the first place. im not understanding the question

I suggest resetting this step and trying again. Don’t change any of the code in the caesar function. Then simply assign your caesar function call with the arguments provided (careful with capitalization!) to an encrypted_text variable. Since this variable is outside of the function, it is a global variable and there should be no indentation.

This is how you assign 5 to the a variable

a = 5

Now you need to assign the function call (or the result of the function call) to the encrypted_text variable.

There are two scopes here, the function scope and the global scope.

def function():
    a = 2
    #a is in the function scope

b = 3
#b is in the global scope

removed by moderator

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge. How to Help Someone with Their Code Using the Socratic Method

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.