Learn String Manipulation by Building a Cipher - Step 49

I don’t know what im doing wrong, i followed the instuction given, any Ideas

Your code so far


# User Editable Region

text = 'Hello Zaira'
shift = 3
def ceaser():
    alphabet = 'abcdefghijklmnopqrstuvwxyz'
    encrypted_text = ''

    for char in text.lower():
        if char == ' ':
            encrypted_text += char
        else:
            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/130.0.0.0 Safari/537.36 OPR/115.0.0.0 (Edition std-2)

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 49

you have a typo here, double check what name you are asked to use for the function

Thank you for the fast response, I’ve corrected the typo but the code still dose not function.

please share your updated code

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

text = 'Hello Zaira'
shift = 3
def ceasar():
    alphabet = 'abcdefghijklmnopqrstuvwxyz'
    encrypted_text = ''

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

the name of the function is the same as before, you have not changed it

oh, wait, you have, but it’s still not as required

1 Like

LOL i have to read correctly, Thank you!!!