Learn String Manipulation by Building a Cipher - Step 49

Tell us what’s happening:

Describe your issue in detail here.
What should I do

Your code so far


/* User Editable Region */

message = 'Hello Zaira'
offset = 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(message, offset)

/* User Editable Region */

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 49

So, what exactly is the problem with the code?

Hell, i found the solution of the problem

Mod Edit SOLUTION REMOVED

you shouldn’t rename the variable “encrypted_text”

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