Learn String Manipulation by Building a Cipher - Step 50

Tell us what’s happening:

i’ve tried the function in the (else) and off the (else)

Your code so far

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)

# User Editable Region

    print('encrypted text:', encrypted_text)
    function_caesar()

# 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/125.0.0.0 Safari/537.36 Edg/125.0.0.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 50

Function name is: caesar, not function_caesar.

The function call also has to be outside of the scope of the function defination.
You need to put the function call at the first level of indentation.

You should call your caesar function. Make sure to write the function call at the beginning of the line.

Don’t indent the function call caesar() inside the function definition.
Put it ouside of the function definition (no spaces before it).

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)

    # DON'T put the function call here

# Put the function call here