Mar-17-2019, 08:24 PM
Thanks for your help, but the issue unfortunately remains.
here is the changed code:
here is the changed code:
import numpy as np def is_symmetric(A): return (np.array(A) == np.array(A.transpose())).all def is_skew(A): return (np.array(A) == -np.array(A.transpose())).all def test_matrix(A): if is_symmetric(np.any(A)): return 1 if is_skew(np.any(A)): return -1 else: return 0 if __name__ == '__main__': a, b, c, d, e, f, g, h, i = 0,1,2,3,4,5,6,7,8 A = [[a, b, c], [d, e, f], [g, h, i]] print("Testing matrix A: ", test_matrix(A))