代码如下:
import os
while True:
dynamic = input('输入计算表达式:')
if dynamic != 'cls':
try:
result = eval(dynamic)
print('计算结果:'+str(result))
except:
print('计算表达式输入有误!')
else:
command = 'cls'
os.system(command)
查看更多关于python简易计算器程序,代码就几行的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did90663