title: Equation solver raises SyntaxError
body: <p>I am trying to make an equation solver that solves a given equation using loop</p>
  <pre><code>def eqn(step,dumbthing): #function supposed to solve an equation of proper syntax
  x=-1000 #start at -1000
  constant_value=(((dumbthing.replace(&quot; &quot;,&quot;&quot;)).replace(&quot;=&quot;,&quot; &quot;)).split())[1] #constant value side (here, R.H.S) of the equation by splitting the two sides
  equate=(((dumbthing.replace(&quot; &quot;,&quot;&quot;)).replace(&quot;=&quot;,&quot; &quot;)).split())[0] #L.H.S
  stuff=set(&quot;qwertyuiopasdfghjklzxcvbnm&quot;) #other stuff that are used as variables
  for dumbstuff in stuff:
      equate=(equate.lower()).replace(dumbstuff,&quot;x&quot;) #replace all types of stuff with &quot;x&quot;
  realthing=dumbthing
  while &quot;xx&quot; in realthing: #in case there is something like &quot;pq&quot; the replaced result will be &quot;xx&quot;
      realthing=realthing.replace(&quot;xx&quot;,&quot;x&quot;) #replace adjacent &quot;xx&quot;s with single &quot;x&quot;
  while x&lt;=1000: #solve equation by looping for x uptil 1000
      if eval(realthing)==eval(constant_value): #evaluate the two sides
          return x #return value of x
      x+=step #step is the step value of loop
  print(eqn(1,&quot;2*pq=8&quot;))
  </code></pre>
  <p>However, the above code raises a SyntaxError instead of doing the job....</p>
  <pre><code>Traceback (most recent call last):
  File  &quot;/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py&quot;, line 31, in &lt;module&gt;
  start(fakepyfile,mainpyfile)
  File &quot;/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py&quot;, line 30, in start
  exec(open(mainpyfile).read(),  __main__.__dict__)
  File &quot;&lt;string&gt;&quot;, line 15, in &lt;module&gt;
  File &quot;&lt;string&gt;&quot;, line 12, in eqn
  File &quot;&lt;string&gt;&quot;, line 1
  2*pq=8
      ^
  SyntaxError: invalid syntax
  
  [Program finished]
  </code></pre>
  <p>I have tried all sorts of ways, none of them seemed to work.
  <em>Any help will be highly appreciated</em></p>