Learn String Manipulation by Building a Cipher - Step 14

Tell us what’s happening:

Step 14
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 in the alphabet, and replace the original letter with the new letter.

To implement this, you will use the .find() method discussed in the previous step. Modify your existing .find() call passing it text[0] as the argument instead of ‘z’.
Please solve this

Your code so far


# User Editable Region

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
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/130.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 14

1 Like

Hi there and welcome to our community!

When you put quote marks around something, it becomes a string.
So your find method is searching for the string ‘text[0]’ in the alphabet string, as opposed to searching for the character at the first index of the text string.

1 Like