Question: Please solve this Python question. Found solution thank you Question - 04 Connect four is a two player board game. Given a complete connect-four board,
Please solve this Python question.
Found solution thank you
Question - 04 Connect four is a two player board game. Given a complete connect-four board, determine who is the winner. User-1 is represented by 1 User-2 is represented by 2 Winner is the one with the highest number of sets of 4 consecutive numbers. A set can be comprised of same numbers on row, column, diagonal or anti-diagonal basis. X= [2 2 11 2 1 2; 1 2 2 11 1 1; 1 211 2 2 2 2 1 2 2 2 1 1; 1 1 2 1 2 1 1; 2 1 1 2 2 2 1] here in the 5th column, we've a set of 2; in the 2nd row, we've a set of 1; in the 2nd anti-diagonal, we've a set of 1; so, 1 is the winner. For simplicity, ignore the diagonal and anti-diagonal matches for now. only consider row or column wise. To simplify even further, consider number of consecutive elements will not be greater than 4. write a function that will take a 2D array as input. return the winner - 1 or 2. If it is a tie, return e. def ques_04(n): return # run this cell to check your output. Don't modify this cell X= [[2, 2, 1, 1, 2, 1, 2], [1, 2, 2, 1, 1, 1, 1], [1, 2, 1, 1, 2, 1, 2], [1, 2, 2, 2, 2, 1, 1]] y=@ ques_04(x)==y