title: Testing if the matrix is a symmetric or skew-symmetric?
body: <p>I'm doing my Laboratory exercise in Python.
  i made the code but i don't know how will i make a test if the matrix is a symmetric or skew-symmetric. The problems are:
  1. Make a test if the matrix is symmetric or skew-symmetric.
  2. How will I use assertion to be sure that the matrix is a square matrix?
  3. Can someone make a recheck to my codes?
  Thanks!</p>
  
  <pre><code>def symmetric(X):
  H = X.copy()
  D = len(H)
  F = len(H[0])
  listx = []
  listy = []   
  for d in range(0,D):
      listx.append(0)
  for f in range(0,F):
      listy.append(listx)
  K = np.array(listy)
  for i in range(0,D):
      for j in range(0,F):
          K[j][i] = H[i][j]
  return K
  
  def skewsymmetric(Y):
  H = Y.copy()
  D = len(H)
  F = len(H[0])
  listx = []
  listy = []
  R = -1
  for d in range(0,D):
      listx.append(0)
  for f in range(0,F):
      listy.append(listx)
  K = np.array(listy)
  for i in range(0,D):
      for j in range(0,F):
          K[j][i] = H[i][j]*R
  return K
  
  if __name__ == "__main__":
  X = np.array([[20,120,200],[120,10,150],[200,150,30]])
  Y = np.array([[0,1,-3],[-1,0,-2],[3,2,0]])
  print "X =", X
  print "Y =", Y
  print "This is Symmetric matrix:", symmetric(X)
  print "This is Skew-symmetric matrix:", skewsymmetric(Y)
  </code></pre>