def test_rewind_randint(): writeint(r()) checkpoint() writeint(r()) rewind() writeint(r()) v = readints() assert len(v) == 4 assert v[0] != v[1] assert v[1] == v[2] assert v[2] != v[3] assert v[0] != v[2] assert v[1] != v[3] assert v[0] != v[1]
from rew import rewind, checkpoint from sys import stdin loc = dict() glob = dict() while True: checkpoint() print(loc) print(">>>", end="", flush=True) snippet = stdin.readline().strip() if snippet == "": rewind(-1) break if snippet == "undo": rewind() else: try: exec(snippet, glob, loc) except Exception as e: print(e)