Learn String Manipulation by Building a Cipher - Step 51

Tell us what’s happening:

I tried to call the function and I called correctly and shows exactly the final result, but the tutorial still says that “You should call your function again, this time passing text and 13 as arguments.” Things that I already made. Tried to do the correct thing, done the correct function call but the tutorial still shows that my code didn’t pass. Why?

Your code so far


text = "Hello Zaira"

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

    for char in text.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:', text)
    print('encrypted text:', encrypted_text)

caesar(text, 13)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 51

1 Like

it says “again”, maybe you need two function calls?

No I need only this function call:

‘’’
caesar(text, 13)

‘’’

The text (String) variable is “Hello Zaira”. And the offset is a constant integer with the value 13.

1 Like

but it doesn’t work, so maybe keep the other one

keep the other function call, do not delete things you are not instructed to delete

I tried both calls but still says “Sorry, your code does not pass. You’re getting there.” Despite the code being correct and showing this at the output:

>>> plain text: Hello Zaira
>>> encrypted text: uryyb mnven

you need to have two function calls, they should be in the code at the same time

And how can I put this correctly (despite thinking that this is correct)?

function(data, argument);
function(data,56);

Here I’ve called a function, and then called it again with a different argument.

2 Likes

reset the code, see the previous function call appear, write the new function call requested on a new line

the function should be called but without data and argument. simply function ()