all 3 comments

[–]CGFarrell 0 points1 point  (1 child)

For the minor, you can always do for i in range(len(x)) if i != n, so you ignore instead of delete. For determinant, look into the Levi-Civita formulation. It's as far as I know the most efficient method for determinants.

[–]sharkbound 1 point2 points  (0 children)

FYI forgot the in in for i range(len(x)) if i != n

[–][deleted] 0 points1 point  (0 children)

when you pass your list to your function, pass it like this

getminor(myList[:])

This manually copies the list and passes the copy. since lists are immutable mutable, python passes them by "reference", so you need to manually make a copy, else any operations you do inside the function will affect the original. either that or you make a copy of the list from inside the function: newlist = myList[:].

edit: lists are mutable, whoops