-1

question:

why does this code in the editor compile

name = "Sophie"
for i in name:
  print(f"***{i}***")

giving this result

***S***
***o***
***p***
***h***
***i***
***e***

but the same entry in the interactive shell gives this error back?

>>> name = "Sophie"
>>> for i in name:
... print(f"***{i}***")
  File "<stdin>", line 2
    print(f"***{i}***")
    ^
IndentationError: expected an indented block

1 Answers1

-1
>>> name = "Sophie"
>>> for i in name:
... <try press tab in here>print(f"***{i}***")

You miss that indentation.

Darcy
  • 160
  • 1
  • 9