human
What is a code to removing row or column wise duplicates from matrix of characters and the other steps required given the following:
Removing row or column wise duplicates from matrix of characters | Function to check duplicates in row and column.
Create an array isPresent and initialize all entries of it as false . The value of isPresent [ i ] [ j ] is going to be true if s [ i ] [ j ] is present in its row or column ..
Checking every row for duplicates of a [ i ] [ j ].
Checking every row for duplicates of a [ i ] [ j ].
If the character is unique in its row and column.
Driver Code.
character array.
Calling function"
How can the above be solved in Python?
assistant
#Here is code to removing row or column wise duplicates from matrix of characters and the other steps required.
 def findDuplicates ( a , n , m ) :
	isPresent = [ [ False for i in range ( n ) ] for j in range ( m ) ]
	for i in range ( n ) :
		for j in range ( m ) :
			for k in range ( n ) :
				if i != k and a [ i ] [ j ] == a [ k ] [ j ] :
					isPresent [ i ] [ j ] = True
					isPresent [ k ] [ j ] = True
			for k in range ( m ) :
				if j != k and a [ i ] [ j ] == a [ i ] [ k ] :
					isPresent [ i ] [ j ] = True
					isPresent [ i ] [ k ] = True
	for i in range ( n ) :
		for j in range ( m ) :
			if not isPresent [ i ] [ j ] :
				print ( a [ i ] [ j ] , end = " " )
if __name__ == " _ _ main _ _ " :
	n = 2
	m = 2
	a = [ " zx " , " xz " ]
	findDuplicates ( a , n , m )