Python syntax error (in the interpreter) after a for loop

The ... prompt in the REPL means that it still hasn't finished the previous block. You will need to press Enter on an empty line to terminate it first.