Learn String Manipulation by Building a Cipher - Step 51

Tell us what’s happening:

Describe your issue in detail here.
Now, the caesar function is called with the text variable and the integer 13 as arguments. BUT DOESN4T WORK

Your code so far

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

for char in message.lower():
    if char == ' ':
        encrypted_text += char
    else:
        index = alphabet.find(char)
        new_index = (index + offset) % len(alphabet)
        encrypted_text += alphabet[new_index]

print('Original text:', message)
print('Encrypted text:', encrypted_text)

text = ‘Hello Zaira’
shift = 13

Call the function with different arguments

caesar(text, shift)


# User Editable Region

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

    for char in message.lower():
        if char == ' ':
            encrypted_text += char
        else:
            index = alphabet.find(char)
            new_index = (index + offset) % len(alphabet)
            encrypted_text += alphabet[new_index]

    print('Original text:', message)
    print('Encrypted text:', encrypted_text)

text = 'Hello Zaira'
shift = 13

# Call the function with different arguments
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/120.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 51

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.

Welcome to the forum @mohamedchahbaniaze10

Please reset the step to restore the original code.

Then call the caesar function with the arguments as text and 13
No other code is requrred.

Happy coding