Spaces:
Running
Running
File size: 625 Bytes
9880f39 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
def simulate_python_interpreter():
print("Python 3.9.7 (default, Sep 3 2022, 02:21:24)")
print("[GCC 11.2.0] on linux")
print("Type 'help', 'copyright', 'credits' or 'license' for more information.")
while True:
try:
print(">>> ")
user_input = input()
if user_input.lower() == 'exit()':
print("Exiting Python interpreter simulator.")
break
result = eval(user_input)
print(result)
except Exception as e:
print("Error:", e)
if __name__ == "__main__":
simulate_python_interpreter() |