Python: arguments - 4 arguments allowed, 5 given
Question: Trying to create a matrix to start a search algorithm.

    
    
    from numpy import *
    
    z11 = vars()
    z12 = vars()
    z13 = vars()
    z14 = vars()
    z21 = vars()
    z22 = vars()
    z23 = vars()
    z24 = vars()
    z31 = vars()
    z32 = vars()
    z33 = vars()
    z34 = vars()
    z41 = vars()
    z42 = vars()
    z43 = vars()
    z44 = vars()
    
    A = matrix([z11,z12,z13,z14], [z21,z22,z23,z24], [z31,z32,z33,z34], [z41,z42,z43,z44])
    

When it is run for errors, it comes up with:

    
    
    Traceback (most recent call last):
      File "Fusion Puzzle Algorithm 2.py", line 20, in <module>
        A = matrix([z11,z12,z13,z14], [z21,z22,z23,z24], [z31,z32,z33,z34], [z41,z42,z43,z44])
    TypeError: __new__() takes at most 4 arguments (5 given)
    

How can I get this to work?


Answer: You likely want something like:

    
    
    A = matrix([[z11,z12,z13,z14], [z21,z22,z23,z24], [z31,z32,z33,z34], [z41,z42,z43,z44]])
    

Note that there is only one argument to the matrix constructor.

