Learn String Manipulation by Building a Cipher - Step 49

Tell us what’s happening:

Describe your issue in detail here.
where is the error

Your code so far

/* User Editable Region */

message = 'Hello Zaira'
offset = 3

def caesar(message, offset):
    alphabet = 'abcdefghijklmnopqrstuvwxyz'
    encrypted_text = ''

    for char in text.lower():
        if char == ' ':
            encrypted_text += char
            index = alphabet.find(char)
            new_index = (index + shift) % len(alphabet)
            encrypted_text += alphabet[new_index]
    print('plain text:', text)
    print('encrypted text:', encrypted_text)


/* 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/ Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 49

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

your code looks good, if you still facing error restart your browser

they give same error
after restart my browser

Hello rr,

You’re only supposed to rename the textand shift variables inside the function body. Nothing above it. Also you will have to add the comments back. I would advise to reset the step and make sure you only rename the variables inside the function body now.

1 Like

step 49 require you to rename text and shift variable inside the function to message and offset respectively. for example

you need to check the other areas where you need to change the variable inside the function

Hi @rr7499042 , @tariq89q
there are about 3 places that you still need to update in your code.

Update and you are good.

NOTE you do not need to update those variable initialization as there are not in your function body.

1 Like

yup, that what we are saying to him :+1:

i just gave him an example for one variable and @rr7499042 needs to find the remaining :slight_smile:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.