## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# Stride tricks for Sudoku

The `ndarray` class has a `strides` field, which is a tuple indicating the number of bytes to step in each dimension when going through an array. Let's apply some stride tricks to the problem of splitting a Sudoku puzzle into the 3 x 3 squares it is composed of.

### Note

Explaining the rules of Sudoku is outside the scope of this book. In a nutshell, a Sudoku puzzle consists of 3 x 3 squares. Each of these squares contains nine numbers. For more information see http://en.wikipedia.org/wiki/Sudoku.

## How to do it...

Apply the stride tricks as follows:

1. Let's define the `sudoku` array. This array is filled with the contents of an actual, solved Sudoku puzzle:
`sudoku = np.array([ [2, 8, 7, 1, 6, 5, 9, 4, 3], [9, 5, 4, 7, 3, 2, 1, 6, 8], [6, ...`

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required