Back to Freecodecamp

Step 17

curriculum/challenges/english/blocks/learn-string-manipulation-by-building-a-cipher/655209a4a27dd37873c4cac3.md

latest1.1 KB
Original Source

--description--

.find() returns the index of the matching character inside the string. If the character is not found, it returns -1. As you can see, the first character in text, uppercase 'H', is not found, since alphabet contains only lowercase letters.

You can transform a string into its lowercase equivalent with the .lower() method. Add another print() call to print text.lower() and see the output.

--hints--

You should still have print(index) in your code. Pay attention to have the function call at the beginning of the line.

js
assert.match(code, /^print\s*\(\s*index\s*\)/m)

You should print text.lower(). Pay attention to place the function call at the beginning of the line.

js
assert.match(code, /^print\s*\(\s*text\.lower\s*\(\s*\)\s*\)/m)

Your code contains invalid syntax and/or invalid indentation.

js
({test: () => assert(true) })

--seed--

--seed-contents--

py
--fcc-editable-region--
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
index = alphabet.find(text[0])
print(index)
--fcc-editable-region--