Q:

Linear Regression Using Linear Algebra in Python

Am I interpreting these formulas on wikipedia (https://en.wikipedia.org/wiki/Coefficient_of_determination)
 wrong in Python?  Below is what I have tried.

def ss_res(X, y, theta):

    y_diff=[]
    y_pred = X.dot(theta)

    for i in range(0, len(y)):
        y_diff.append((y[i]-y_pred[i])**2)

    return np.sum(y_diff)

output looks correct but the numbers are slightly off...like a few decimal points.

def std_error(X, y, theta):

    delta = (1/(len(y)-X.shape[1]+1))*(ss_res(X,y,theta))
    matrix1=matrix_power((X.T.dot(X)),-1)
    thing2=delta*matrix1
    thing3=scipy.linalg.sqrtm(thing2)

    res=np.diag(thing3)
    serr=np.reshape(res, (6, 1))
    return serr

std_error_array=std_error(X,y,theta)

A:

You may or may not want the +1 in what you call delta, depends on whether your X includes a "constant" column (i.e. all values = 1)
Otherwise it looks OK if a little non-Pythonic.  I'd be tempted to write them more as:
import numpy as np
from numpy.linalg import inv
from scipy.linalg import sqrtm

def solve_theta(X, Y):
    return np.linalg.solve(X.T @ X, X.T @ Y)

def ss_res(X, Y, theta):
    res = Y - (X @ theta)
    return np.sum(res ** 2)

def std_error(X, Y, theta):
    nr, rank = X.shape
    resid_df = nr - rank
    residvar = ss_res(X, Y, theta) / resid_df
    var_theta = residvar * inv(X.T @ X)
    return np.diag(sqrtm(var_theta))[:,None]

Note: this uses Python 3.5 style matrix multiply operator @ instead of writing out .dot() 
Numerical stability of this sort of algorithm isn't amazing, you might want to look at using SVD or a QR decompositions.  there's an approachable description how you'd do it with SVDs in:

John Mandel (1982) "Use of the Singular Value Decomposition in Regression Analysis"  10.1080/00031305.1982.10482771

We can test this by creating some dummy data:
np.random.seed(42)

N = 20
K = 3

true_theta = np.random.randn(K, 1) * 5
X = np.random.randn(N, K)
Y = np.random.randn(N, 1) + X @ true_theta

and run the above code on it:
theta = solve_theta(X, Y)
sse = std_error(X, Y, theta)

print(np.column_stack((theta, sse)))

which gives:
[[ 2.23556391  0.35678574]
 [-0.40643163  0.24751913]
 [ 3.14687637  0.26461827]]

We can test this with statsmodels:
import statsmodels.api as sm

sm.OLS(Y, X).fit().summary()

which gives:
                 coef    std err          t      P>|t|      [0.025      0.975]
------------------------------------------------------------------------------
x1             2.2356      0.358      6.243      0.000       1.480       2.991
x2            -0.4064      0.248     -1.641      0.119      -0.929       0.116
x3             3.1469      0.266     11.812      0.000       2.585       3.709

which is pretty close.

