Learn String Manipulation by Building a Cipher - Step 56

Tell us what’s happening:

why is my code not runing after caling a function

Your code so far


# User Editable Region

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

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

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 56

Are you getting any error messages? Investigate those.

yes am getting error message, even before any line of code could run.

What is the error? What does it tell you?

Look at the code that the error indicates.

(I already knew you had an error, it wasn’t really a yes or no question but a hint about where to start troubleshooting :face_with_monocle: )

it points the main error at the integer (13)

def text(13):
this part in the code

Ok, what does that code do?

it supposed to print out an argument passed to the text function, only if i end up printing it out

which is the value inside of the parameters (13)

do you want to call a function or define it there?

Step 56
At the bottom of your code, after your existing caesar(text, shift) call, call your function again.

This time, pass the text variable and the integer 13 as arguments.

So you’ve already called your function in a previous step, and you want to do the same thing. Can you find the line of code where you’ve called your function previously?

I will say that def: means to “define” your function, not to call it.

1 Like

I was supposed to call a new function there

yes i can find it. ohh, thanks I got this one now :hand_with_index_finger_and_thumb_crossed:I’ll try that.

1 Like