human
Give me a code to game of replacing array elements and the other steps required given the following:
Game of replacing array elements | Function return which player win the game.
Create hash that will stores all distinct element.
Traverse an array element.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to game of replacing array elements and the other steps required.
 def playGame ( arr , n ) :
	s = set ( )
	for i in range ( n ) :
		s . add ( arr [ i ] )
	return 1 if len ( s ) % 2 == 0 else 2
arr = [ 1 , 1 , 2 , 2 , 2 , 2 ]
n = len ( arr )
print ( " Player " , playGame ( arr , n ) , " Wins " )