human
Give me a the Python code you requested given the following:
I found an interesting problem on https://www.codewars.com/kata/58f89357d13bab79dc000208:
Your task is to build a model^(1) which can predict y-coordinate.
You can pass tests if predicted y-coordinates are inside error margin.

You will receive train set which should be used to build a model. 
After you build a model tests will call function ```predict``` and pass x to it. 

Error is going to be calculated with RMSE.


Blocked libraries: sklearn, pandas, tensorflow, numpy, scipy

Explanation
[1] A mining model is created by applying an algorithm to data, but it is more than an algorithm or a metadata container: it is a set of data, statistics, and patterns that can be applied to new data to generate predictions and make inferences about relationships.

I tried it in Python, but could not do it. Can you solve it?
assistant
#Here is the Python code you requested.

class Datamining:

    def __init__(self, train_set):
        total = len(train_set)
        x = []
        for i in train_set:
            x.append(i[0])
        y = []
        for i in train_set:
            y.append(i[1])
        xmean = sum(x)/total
        ymean = sum(y)/total
        a = 0
        b = 0
        for i in range(total):
            a += (x[i]-xmean) * (y[i] - ymean)
            b+= (x[i]-xmean)**2
        self.z = a/b
        self.y = ymean - (self.z*xmean)

    def predict(self, x):
        return x*self.z + self.y
        pass