代码:
代码如下:
import os while true: dynamic = input(‘输入计算表达式:’) if dynamic != ‘cls’: try: result = eval(dynamic) print(‘计算结果:’+str(result)) except: print(‘计算表达式输入有误!’) else: command = ‘cls’ os.system(command)
A programmer’s note boke for work and life
代码:
代码如下:
import os while true: dynamic = input(‘输入计算表达式:’) if dynamic != ‘cls’: try: result = eval(dynamic) print(‘计算结果:’+str(result)) except: print(‘计算表达式输入有误!’) else: command = ‘cls’ os.system(command)