Learn String Manipulation by Building a Cipher - Step 13

Tell us what’s happening:

where did I go wrong and how do I fix it

Your code so far


# User Editable Region

text = 'Hello World'
shift = 3
alphabet = 'abcdefghigklmnopqrstuvwxyz'
alphabet.find(alphabet)
alphanet[0]



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

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 13

A typo maybe? Check the spelling.

I did and it is still wrong

What error message are you getting? Looking carefully at the exact wording of the error message can often help.

You should call the .find() method on the alphabet variable.

What do you think should go inside the ()? In other words, what are you trying to find?

I am trying to find ‘w’ but even when I change to it, it still says error

Please show me your code, and the instructions

INSTRUCTION
Start by finding the position of the first letter in the string. One way is to call the .find() string method on the string you want to parse:

text.find('W')

Above, uppercase W is the character you want to locate inside the string stored in the text variable. The method will return 6, which is the index of the W character inside the string stored in the text variable.

At the end of your code, call .find() on your alphabet string and pass text[0] to the method. Note that a method is just a function that belongs to an object (you will learn more about that in another project).

CODE
text = ‘Hello World’

shift = 3

alphabet = ‘abcdefghijklmnopqrstuvwxyz’

.find(alphabet)

alphabet[0]

In the instructions, it says

You must do exactly what it says.
Why have you got alphabet[0] at the end?

Call .find() on x means x.find(). Pass y to .find() means you need to add y between the parentheses. You need to do this in a single line, as in the example.

1 Like

I was trying out different solutions I guess

I can understand that - I’ve done that before :slight_smile:
Did you solve the problem?

nope still trying and I even hit rest

ok - let me see your new code and the error message

new code
print(alphabet.find(“w”)) text[0] You should call the .find() method on the alphabet variable and pass text[0] to the method. Pay attention to place the method call at the beginning of the line.

I am legit just trying different things here :smiling_face_with_tear:

error message

I finally got it and thank you so much, I was just about to give up :smiling_face_with_tear:

Open a new topic, share your code, ask any questions that you may have.

Sharing solution code is not what the forum is for.

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.