from numpy import * meshes = input("Number of meshes: ") voltage = zeros(meshes) resistence = zeros((meshes, meshes)) for i in range(meshes): voltage[i] = input("Voltage of mesh %d: " % i) resistence[i][i] = input("Resistence of mesh %d: " % i) for i in range(meshes): for j in range(meshes): if i != j: resistence[i][j] = -input("Resistence between mesh %d and %d: " % (i, j)) result = dot(linalg.inv(resistence), voltage) print result