human
I found an interesting problem on https://www.codewars.com/kata/56d6d927c9ae3f115b0008dd:
To almost all of us solving sets of linear equations is quite obviously the most exciting bit of linear algebra. Benny does not agree though and wants to write a quick program to solve his homework problems for him. Unfortunately Benny's lack of interest in linear algebra means he has no real clue on how to go about this. Fortunately, you can help him!

Write a method ```solve``` that accepts a list of linear equations that your method will have to solve. The output should be a map (a `Map` object in JavaScript) with a value for each variable in the equations. If the system does not have a unique solution (has infinitely many solutions or is unsolvable), return ```null``` (`None` in python).

For example :  
  
"2x + 4y + 6z = 18"  
"3y + 3z = 6"  
"x + 2y = z - 3"
  
should result in a map :  
  
x = 2  
y = -1  
z = 3  
  
Possible input equations have the following rules:  
-   Only the plus and minus operators are used on both the left and right hand side of the equation.  
-   Both sides of the equation can have variables.
One variable can appear in multiple terms, on both sides.
-   Variable names are strings of arbitrary length.  
-   All coefficients are integers and generally fall within the range of -150 to 150, with a few ranging from -1000 to 1000. Free terms are integers in range -20000 to 20000.  
-   Equations do not necessarily have variables.  
-   Equations have exactly one operator (+ or -) between terms.  

Comparisons are performed with accuracy of `1e-6`.

**Note on numerical stability:**

There are many possible ways to solve a system of linear equations. One group of such algorithms is based on reduction and elimination methods. If you are going to use any of these, remember that such algorithms are in general *numerically unstable*, i.e. division operations repeated over and over introduce inaccuracies which accumulate from row to row. As a result it might occur that some value which is expected to be zero is actually larger, for example, `2.5e-10`. Such inaccuracies tend to be...

I tried it in Python, but could not do it. Can you solve it?

 Give me a the Python program you requested?
assistant
#Here is the Python program you requested.

import re
from fractions import Fraction
def solve(*equations): 
        equations2 = []
        for x in equations:
           equations2.append(x)
        equations = equations2
        def parsing(equations):
            vectconstant = []
            matrixcoefficient = []
            listvariables = []
            for equation in equations :
                eqvariables = re.findall('[A-Za-z]+' , equation )
                listvariables = listvariables + eqvariables
            listvariables = list(set(listvariables))  
            for equation in equations :
                listcoefficient = []
                equation = re.sub('\s' , '' , equation)
                eqdivided = equation.split('=')
                firstp , secondp = eqdivided[0] , eqdivided[1]
                constantterm1 = re.findall('[\-\+]*\d+\.?\d*(?=[+-])|[\-\+]*\d+\.?\d*$', firstp)
                constantterm2 = re.findall('[\-\+]*\d+\.?\d*(?=[+-])|[\-\+]*\d+\.?\d*$', secondp)
                for x in range(len(constantterm1)):
                    constantterm1[x] = '-' + constantterm1[x]
                    constantterm1[x] = re.sub('\+\+|\-\-', '+', re.sub('\+\-|\-\+', '-',constantterm1[x]))
                constantterm = Fraction((sum(list(map(float, constantterm1 + constantterm2)))))
                vectconstant.append(constantterm)
                for x in listvariables :
                    values1 = re.findall('([\-\+]*[\d.]*)'+re.escape(x)+'(?=[+-]|$)' , firstp)
                    values2 = re.findall('([\-\+]*[\d.]*)'+re.escape(x)+'(?=[+-]|$)', secondp)
                    for x in range(len(values2)): 
                        values2[x] = '-' + values2[x]
                        values2[x] = re.sub('\+\+|\-\-', '+', re.sub('\+\-|\-\+', '-',values2[x]))
                    values = values1 + values2
                    for x in range(len(values)):
                        if values[x] == '' or values[x] == '+' :
                            values[x] = '1'
                        elif values[x] == '-' :
                     ...