Learn String Manipulation by Building a Cipher - Step 49

Tell us what’s happening:

Describe your issue in detail here.

Your code so far

Unable to understand what does it want from me. I changed whole code than changed the variables inside the function but all in vain. Can any body help here?

# User Editable Region

text = 'Hello Zaira'
shift = 3

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

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


# 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.


Only change “text” and “shift” inside the caesar function to the parameters “message” or “offset”.

The variable “encrypted_text” and the string “encrypted text” are part of the function and remain the same.

The goal of the challenge is to use parameters as placeholders to make the function reusable. In this case message and offset will hold the place for the outside variables text and shift.