Mar-19-2019, 09:28 PM
since this issue is persisting,
I have tried to write this code in a different way,
however, the outcome remains the same (1 no matter the values in the matrix).
Can you please tell me if you think this code has mistakes or not?
Thank you.
I have tried to write this code in a different way,
however, the outcome remains the same (1 no matter the values in the matrix).
Can you please tell me if you think this code has mistakes or not?
Thank you.
def isSymmetric(mat,N): for i in range(N): for j in range(N): return (mat[i][j] == mat[j][i]) def isSkew(mat,N): for i in range(N): for j in range(N): return (mat[i][j]==-mat[j][i]) def test(mat,N): if isSymmetric(mat,N): return 1 if isSkew(mat,N): return -1 else: return 0; # Driver code mat = [ [3,3,3 ], [ 4,4,4 ], [ 5,5,5 ] ] print(test(mat,2))