fork download
  1. import re
  2.  
  3. exp = None
  4. while True:
  5. exp = input('Введите выражение или введите \'exit\'\n')
  6. check_exp = re.findall(r'^\d+\s*[\+\-\/\*]{1}\s*\d+$', exp)
  7. if check_exp:
  8. print(eval(check_exp[0]))
  9. elif exp == 'exit':
  10. break
  11. else:
  12. print('Данные некоректны')
  13. continue
  14.  
Runtime error #stdin #stdout #stderr 0.04s 9520KB
stdin
Standard input is empty
stdout
Введите выражение или введите 'exit'
stderr
Traceback (most recent call last):
  File "./prog.py", line 5, in <module>
EOFError: EOF when reading a line