Learn String Manipulation by Building a Cipher - Step 53

Tell us what’s happening:

le système ne prend pas en compte ma définition de fonction et les différents arguments demandé. je pense qu’il ya un problème avec le système de vérification.
voilà mon code :
def caesar(text,shift):
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 += a

Your code so far

text = 'Hello Zaira'
shift = 3

def caesar(text,shift):
    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

# 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

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 53

why did you change the function parameters?

you need to reset the code, and then work only on the function call

this is the function definition

caesar()

this is a function call

i reset and restart again but i have the same message error( You should pass text and shift as the arguments to your function call by including them inside the parentheses. Don’t forget to separate the arguments with a comma.)

Please share your updated code

text = 'Hello Zaira'
shift = 3

def caesar(text, shift):
    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)

no, focus on the code in the editable region, between the instructions and the Check your code button, it’s set like that for a reason.

You completely deleted the function call, you need the function call for this step

I didn’t delete the function call, it’s just that I can’t share it with you. I’m making another attempt.
It’s the function call at the very bottom of the code, right?

Well, you are all the code:

text = 'Hello Zaira'
shift = 3

def caesar(text, shift):
    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()

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

Please stop changing the function definition…

This is the only thing you must change for this step

1 Like

Hello, it’s me again ,i have try everything but i still have the same error message.
Please help

what is your code now? please share your code when you ask for help

text = 'Hello Zaira'
shift = 3

def caesar(text, shift):
    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(text,shift)

I guess you have not read all the “do not touch this line” instructions…

nor the “change only this” and “make this a proper call instead of a comment” either

ok .Here is the original code when i reset

text = 'Hello Zaira'
shift = 3

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

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


and what do the instructions say to do?

Now i will send to you my new code

text = 'Hello Zaira'
shift = 3

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

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

passing text and shift as arguments to the caesar function call.

this is not a function call, this is now a function definition…