In the given snippet, there's a bug: there's no indentation.
Your goal is to fix it (by just adding 4 spaces at the right place).
The code should display:
Gonna knock three times:
*knock*
*knock*
*knock*
- Who's there?
As you may have guessed by reading the actual code, after the for
line asking Python to repeat three times, Python can't guess what
should be repeated: should Python only repeat print("*knock*")
or
should Python print the two following print
?
To indicate this in Python we do use 4 spaces in front of the lines, like this:
for i in range(5):
print("Hello")
which will display:
Hello
Hello
Hello
Hello
Hello
There's no corrections yet, hit the `Submit` button to send your code to the correction bot.
Keyboard shortcuts: