import math
def eval_loop():
while True:
s = input('enter your str:\n')
if s == 'done':
print('done')
break
result = eval(s)
print(result)
eval_loop()
eval_loop()
运行之后,第一次就输入done,就结束了,如果第一次不是输入done,那么再输入done,程序还会继续运行,这个情况是为啥呢。。
E:--->python helloworld.py
enter your str:
done
done
E:--->python helloworld.py
enter your str:
1+2
3
enter your str:
done
done
enter your str: