Back to Freecodecamp

Step 28

curriculum/challenges/english/blocks/learn-string-manipulation-by-building-a-cipher/65524d2a1a253b8bb5197ae2.md

latest686 B
Original Source

--description--

find is again returning -1 for uppercase letters, and for the space character, too. You are going to take care of the space later on.

For now, instead of iterating over text, change the for loop to iterate over text.lower().

--hints--

You should modify your for loop to iterate over text.lower() instead of text.

js
({test: () => assert.match(code, /^for\s+char\s+in\s+text\.lower\s*\(\s*\)\s*:/m) })

--seed--

--seed-contents--

py
--fcc-editable-region--
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'

for char in text:
    index = alphabet.find(char)
    print(char, index)
--fcc-editable-region--