Ask coding questions

← Back to all posts
Why is there an indentation error within this code?
CarterTimmons03

Why do I receive this error when this code is run? The print command is accurate. I am trying to run two threads at the same time so I can exit from a loop when space is pressed.

Voters
CarterTimmons03
Comments
hotnewtop
MocaCDeveloper

Python is very strict with it's indentation.

On line 15, you have declared a while loop, which thusly requires you to indent line 16, 16, 18 and 19.

CarterTimmons03

Oh wow thanks. I can’t believe I missed that @MocaCDeveloper

VulcanWM

Do ctrl + a (or cmd + a depending on which type of laptop you are on, if you are on one)
and then do tab and then shift + tab