Learn String Manipulation by Building a Cipher - Step 49

Tell us what’s happening:

Can’t see what’s wrong. Could someone please help me???

Your code so far


# User Editable Region

text = 'Hello Zaira'
shift = 3
def caesar():
     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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0.1 Safari/605.1.15

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 49

Hi there and welcome to our community!

You need to indent ALL of the code which follows the function def statement, not just the first couple of lines.

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