Learn String Manipulation by Building a Cipher - Step 13

Tell us what’s happening:

Describe your issue in detail here.
this is the question they asked The first kind of cipher you are going to build is called a Caesar cipher. Specifically, you will take each letter in your message, find its position in the alphabet, take the letter located after 3 positions, and replace the original letter with the new letter.

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.
What does this mean 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).
The clue they gave :

Your code so far


# User Editable Region

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
print(alphabet.find(text[1]))
print(alphabet.find(text[2]))
print(alphabet.find(text[3]))
print(alphabet.find(text[4]))
print(alphabet.find(text[5]))
print(alphabet.find(text[6]))
print(alphabet.find(text[7]))
print(alphabet.find(text[8]))
print(alphabet.find(text[9]))
print(alphabet.find(text[10]))
print(alphabet.find(text[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/122.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 13

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

Welcome to the forum @akhilapasupuleti1723

The instructions did not ask you to place a print call for step 13.
You only need to pass text[0], not all the rest.

Happy coding

alphabet.find(text[0])
is this correct?

Try it and see what happens.

I did and it say " sorry,your code does not pass"

So the forum can assist please post your full code.

Use the following method to post code to the forum:

  1. On a separate line type three back ticks.
  2. On a separate line paste your code.
  3. On the last line type three back ticks. Here is a single back tick `
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
alphabet.find(text[0]) ```
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
alphabet.find('c')
alphabet.find(text['0'])
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
alphabet.find('c')
alphabet.find(text['0'])

Your code should be 4 lines long, you have a lot of extra lines.

The last line is correct. You could reset the step and add your last line again.

Hi @akhilapasupuleti1723

This code block is missing the text variable, it needs to go in line 1 of the code.

Happy coding