Back to Freecodecamp

Step 48

curriculum/challenges/english/blocks/learn-string-manipulation-by-building-a-cipher/6553f6b4ec51112d44d737c8.md

latest785 B
Original Source

--description--

Right before the print call, add another one and pass 'plain text:', text as the arguments to print(). Use the same indentation.

--hints--

You should print 'plain text:', text after your for loop.

js
({ test: () => assert.match(code, /^print\s*\(\s*("|')plain\stext:\1\s*,\s*text\s*\)\s*^print/m) })

--seed--

--seed-contents--

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

for char in text.lower():
    if char == ' ':
        encrypted_text += char
    else:
        index = alphabet.find(char)
        new_index = (index + shift) % len(alphabet)
        encrypted_text += alphabet[new_index]
print('encrypted text:', encrypted_text)
--fcc-editable-region--