Ad
  • Custom User Avatar

    I would try to print out the input of a program for random test. Then do the calculations by hand or get it from the test expectation and incorporate this input in my unit tests.

  • Custom User Avatar

    Few things hit me with that code

    1. Why do we use double loop? Going from top to bottom doing submatrices is enough. So we have to iterate over each element in first row only and then we can use each of those elements as "pivot" from the code.
    2. I think sign should be sign = (-1) ** i.
    3. Why do we need numpy here? If we have acces to numpy, then I think we should use. round(numpy.linalg.det(numpy.matrix(a))) but I think that defeats the purpose of a Kata :-)

    I hope my comment is helpful.

    p.s. I learnt from one of previous kata that in python if you want to remove an n'th element from an array/row you can use something like :
    row = row[:n] + row[n+1:]