初級 › IndentationError: expected an indented block の原因と直し方 › パターン3
IndentationError: expected an indented block の原因と直し方
if・for・def・whileの本体を書き忘れたときに出る、Python学習者が最初につまずくエラーです。
1 for i in range(3): 2 ____print(i) ^
File "main.py", line 2
print(i)
^^^^^
IndentationError: expected an indented block after 'for' statement on line 1
空欄を埋めて実行を通す
forループの本体も同様です。ループの中身がどこまでかは、インデントの深さだけで決まります。
次の問題