Why does the IPython REPL show a "SyntaxError: unexpected EOF while parsing" error when running my code?

Yeah, I’ve bumped into that too during my debugging sessions. To build on what @Rashmihasija said, the unexpected EOF while parsing error basically means Python hit the end of your input before your syntax was fully formed. This is common not just with missing loop bodies, but also with things like forgetting the colon at the end of a for, if, or while statement.*

In IPython, if you just write:

for i in range(5)  

…without the colon, or you hit Enter too soon, it breaks. IPython waits for a complete block to execute. So always check your colons and indentation