https://www.programiz.com/online-compiler/0tHKIWl27M4zf
import numpy as np
n=int(input('Enter the no.of data points: '))
t=list(map(float,input("Enter the value of time: ").strip().split()))[:n]
vc=list(map(float,input("Enter the capacitor volatge value: ").strip().split()))[:n]
t=np.array(t)
vc=np.array(vc)
sx=sum(t)
sy=sum(vc)
sx2=sum(t**2)
sx3=sum(t**3)
sx4=sum(t**4)
sxy=sum(t*vc)
sx2y=sum(t*t*vc)
P=[[n,sx,sx2],[sx,sx2,sx3],[sx2,sx3,sx4]]
Q=[[sy],[sxy],[sx2y]]
A=np.dot(np.linalg.inv(P),Q)
print("Equation of capacitor voltage vc = ",A[0,0],"+",A[1,0],"t+",A[2,0],"t^2").format(A[0,0],A[1,0],A[2,0])