Check if product is identity matrix
for i in range ( 0 , n ) : NEW_LINE INDENT for j in range ( 0 , n ) : NEW_LINE INDENT if ( i != j and prod [ i ] [ j ] != 0 ) : NEW_LINE INDENT return False NEW_LINE DEDENT if ( i == j and prod [ i ] [ j ] != 1 ) : NEW_LINE INDENT return False NEW_LINE DEDENT DEDENT DEDENT return True NEW_LINE