human
I found an interesting problem on https://www.codewars.com/kata/540afbe2dc9f615d5e000425:
Given a Sudoku data structure with size `NxN, N > 0 and √N == integer`, write a method to validate if it has been filled out correctly.

The data structure is a multi-dimensional Array, i.e:
```
[
  [7,8,4,  1,5,9,  3,2,6],
  [5,3,9,  6,7,2,  8,4,1],
  [6,1,2,  4,3,8,  7,5,9],
  
  [9,2,8,  7,1,5,  4,6,3],
  [3,5,7,  8,4,6,  1,9,2],
  [4,6,1,  9,2,3,  5,8,7],
  
  [8,7,6,  3,9,4,  2,1,5],
  [2,4,3,  5,6,1,  9,7,8],
  [1,9,5,  2,8,7,  6,3,4]
]
```

**Rules for validation**

- Data structure dimension: `NxN` where `N > 0` and `√N == integer`
- Rows may only contain integers: `1..N (N included)`
- Columns may only contain integers: `1..N (N included)`
- *'Little squares'* (`3x3` in example above) may also only contain integers: `1..N (N included)`

I tried it in Python, but could not do it. Can you solve it?

What is a the Python code you requested?
assistant
#Here is the Python code you requested.

import math

class Sudoku(object):
    def __init__(self, board):
        self.board = board
        self.size = len(board)

    @staticmethod
    def reduce_logic(seq):
        return reduce(lambda x, y: x and y, seq)

    def is_square(self):
        return self.reduce_logic(map(lambda x: len(x) == self.size, self.board))

    def check_number(self):
        return self.reduce_logic(map(lambda x: 0 < x <= self.size and type(x) == type(1),
                                     reduce(lambda x, y: x + y, self.board)))

    def check_seq(self, seq):
        return self.reduce_logic(map(lambda x: len(set(x)) == self.size, seq))

    def check_rows(self):
        return self.check_seq(self.board)

    def check_cols(self):
        cols = [map(lambda x: x[i], self.board) for i in range(self.size)]
        return self.check_seq(cols)

    def check_little_squares(self):
        sq = int(math.sqrt(self.size))
        squares = [reduce(lambda x, y: x + y, map(lambda x: x[i:(i + sq)], self.board[j:(j + sq)]))
                   for j in range(0, self.size, sq)
                   for i in range(0, self.size, sq)]
        return self.check_seq(squares)

    def is_valid(self):
        if (self.is_square() and
                self.check_number() and
                self.check_rows() and
                self.check_cols() and
                self.check_little_squares()):
            return True
        else:
            return False