Learn String Manipulation by Building a Cipher - Step 54

Tell us what’s happening:

I cant understend error in 54 Task, i must rename all text to message . But where i dont do it?

Your code so far


# User Editable Region

text = 'Hello Zaira'
shift = 3
def caesar(message, offset):
    alphabet = 'abcdefghijklmnopqrstuvwxyz'
    encrypted_message  = ''

    for char in message.lower():
        if char == ' ':
            encrypted_message  += char
        else:
            index = alphabet.find(char)
            new_index = (index + offset) % len(alphabet)
            encrypted_message  += alphabet[new_index]
    print('plain message :', message )
    print('encrypted message :', encrypted_message )

caesar(text,shift)

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

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 54

Welcome to our community!

Do not change the name of the variable in the second print call.

Where did you find instructions for passing any arguments to the function?

Don’t change the names of the given variables with different names from the name of the ‘text’ variable.

1 Like

Hi @arthurleuski,

Adding on to @DobarBREND, double-check your print statements. You only want to change variables, not strings.

So don’t change strings, only change variables that are text and shift, and arguments in your ceasar() function is not required.

Thank you , it help me , my bad with reading task

1 Like