0

I've got a program that parses an input of money to an arithmetic equation (e.g. 2×20p is parsed to 2*20), but I now need to find a way to evaluate that expression.

eg: If a I were to have a string 2*20, it would return 40.

ecjwthx
  • 9
  • 4
  • Remember, [`eval` really is dangerous](https://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html), use [`ast.literal_eval`](https://docs.python.org/3/library/ast.html#ast.literal_eval) instead. – MattDMo Oct 12 '22 at 20:23

0 Answers0