Back to Freecodecamp

Step 14

curriculum/challenges/english/blocks/learn-string-manipulation-by-building-a-cipher/6624e0ec0bf47017eed84b1f.md

latest847 B
Original Source

--description--

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'.

--hints--

You should modify your existing alphabet.find('z') call passing text[0] to the method.

js
assert.match(code, /^alphabet\.find\s*\(\s*text\s*\[\s*0\s*\]\s*\)/m)

--seed--

--seed-contents--

py
--fcc-editable-region--
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
alphabet.find('z')
--fcc-editable-region--