Skip to content Skip to sidebar Skip to footer

Python Unexpected Eof While Parsing (python2.7)

Here's my python code. Could someone show me what's wrong with it? I try to learn an algorithm on solving 24 - point game. But I really don't know why this program has an error. fr

Solution 1:

You're last fmtList item has unbalanced parenthesis:

"(%d%s(%d%s(%d%s%d))"

should be:

"(%d%s(%d%s(%d%s%d)))"

And that explains the traceback -- Python is looking for a closing parethesis -- instead it encounters and end of line (when using eval, the end of line is interpreted as "End Of File" or EOF) and so you get the error.

Post a Comment for "Python Unexpected Eof While Parsing (python2.7)"