Learn String Manipulation by Building a Cipher - Step 49

Tell us what’s happening:

hey I don’t understand how to indent all lines after shift =3
could any one please tell me what to do?

Your code so far


# User Editable Region

text = 'Hello Zaira'
shift = 3
def caesar ():
    pass
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)
caesar()

# 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/17.4.1 Safari/605.1.15

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 49

indent means that you need to add spaces in front of each line.

A shortcut is select all lines and use tab, but make sure you understand what the indentation mean

1 Like

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