Расширение Python Laplace

# Python determinant a la Laplace expansion (Rekursion)
def determinant(matrix):
	d = 0
	if len(matrix) == 2:
		return matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0]
	else:
		for index in range(len(matrix)):
			if index % 2 == 0:
				d += matrix[index][0] * determinant([row[1:] for row in matrix if matrix.index(row) != index])
			else:
				d -= matrix[index][0] * determinant([row[1:] for row in matrix if matrix.index(row) != index])
		return d
Lovely Lark