# -*- coding: utf-8 -*- """ Created on Mon Nov 7 11:01:23 2022 @author: cpresser """ def f(x): return x**2 y = 5.3 data = [4, 5, 7] inString = input("Enter an expression: ") result = "" #make sure result is defined try: #evaluate the input, produce a result result = eval(inString) print("Evaluation Complete") except NameError: #this is only if there is a NameError #something went wrong #print("ERROR!") #in case of a NameError, treat inString as the result result = inString except IndexError as e: #error information in variable e print(f"{inString} {e}") result = data print(f"{result} has the type {type(result)}")