Check if the Formula is Correct

Published by Matt in

Create a function that takes a string and returns true or false depending on whether or not the formula is correct.

Examples

formula("6 * 4 = 24") ➞ true

formula("18 / 17 = 2") ➞ false

formula("(1+2+3+4+5+6+7+8)/a=9") ➞ true

Notes

  • You have to figure out what a is.
  • You do not need to dynamically find the value of a (it's a constant and the same accross all tests).
  • Ignore the spaces.
Watch a quick demo on how Edabit works.