Use compile+eval to support statements and expressions

This commit is contained in:
jesopo 2018-10-12 13:18:06 +01:00
parent 4700402db4
commit c66b376e7f

View file

@ -3,7 +3,8 @@ from src import ModuleManager, utils
EVAL_TEMPLATE = """
import sys
result = eval(sys.stdin.read())
compiled = compile(sys.stdin.read(), 'code', 'single')
result = eval(compiled)
print("")
if not result == None:
sys.stdout.write(str(result))