Complete Algebraic Equations
Question: Im trying to build an app that graphs an equation based on user input. The
equation would be in slope intercept form: `y = mx + b`, for `m` as slope and
`b` as `y intercept`. However, this isn't working for me in python!

I tried this:

    
    
    >>> x = 3
    >>> 1/2x
    

and was returned this:

    
    
      File "<stdin>", line 1
        1/2x
           ^
    SyntaxError: invalid syntax
    >>>
    

How would I make it so that this returns 1.5?


Answer: 
    import re
    mxb = re.compile('''(?P<slope>[(\d)/.]*)x\s+(?P<sign>[+-])\s+(?P<intercept>[\d./]*)''')
    s = '1/2x + 5' 
    match = mxb.match(s)
    if match : 
        print( match.groupdict() )
    

test the python regex here :
[pythex.org](http://pythex.org/?regex=\(%3FP%3Cslope%3E%5B\(%5Cd\)%2F.%5D*\)x%5Cs\(%3FP%3Csign%3E%5B%2B-%5D\)%5Cs\(%3FP%3Cintercept%3E%5B%5Cd.%2F%5D*\)&test_string=x%20%2B%205%0A1%2F2x%20-%202.3%0A.5x%20%2B%201.4&ignorecase=0&multiline=0&dotall=0&verbose=0
"pythex.org")

