Back to Freecodecamp

Step 24

curriculum/challenges/english/blocks/learn-string-manipulation-by-building-a-cipher/65687d2f8c7ee27b0446cef3.md

latest1.2 KB
Original Source

--description--

The code to execute at each iteration — placed after the : — constitutes the body of the loop. This code must be indented. In Python, it is recommended to use 4 spaces per indentation level. This indented level is a code block.

py
for i in text:
    print(i)

Python relies on indentation to indicate blocks of code. A colon at the end of a line is a signal that a new indented block of code will follow.

So, when no indented block is found after the final colon, the code execution stops and an IndentationError is thrown. This code will not show the output and instead raise an IndentationError:

py
for i in text:
print(i)

Give your for loop a body by adding a call to print(i). Remember to indent the loop body.

--hints--

You should add print(i) to your for loop body. Pay attention to the indentation.

js
assert.match(code, /^for\s+i\s+in\s+text:\s+print\s*\(\s*i\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'

for i in text:

--fcc-editable-region--