Back to Freecodecamp

Step 32

curriculum/challenges/english/blocks/learn-string-manipulation-by-building-a-cipher/6568b7a40c7ba0ccbc4b4425.md

latest926 B
Original Source

--description--

As you can see, each character of the reassigned string gets printed inside the loop.

Go back to the original string by deleting the text reassignment.

--hints--

You should not have text = 'Albatross' in your code.

js
const commentless_code = __helpers.python.removeComments(code);
assert.isFalse( /text\s*=\s*("|')Albatross\1/.test(commentless_code))

You should still have a text variable with the value 'Hello World'.

js
({test: () => {
    const commentless_code = __helpers.python.removeComments(code);
    assert.match(commentless_code, /text\s*=\s*("|')Hello World\1/)
  }
})

--seed--

--seed-contents--

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

for char in text.lower():
    index = alphabet.find(char)
    print(char, index)
    new_index = index + shift