I am currently using this Python code:
valid_chars = \"0123456789-+/* \\n\"; while True: x = \"x=\" y = input(\" >> \") x += y if False in
encapsulate your code with a try except
try: y = input(" >> ") except Exception as exc: # process exception here
The reason is the input() is being evaluated as it is read in before y is set. Thus the exception occurs because of the input() and must be caught with the try: .