#73 Sudoku Puzzle

Sudoku is a popular puzzle game in newspapers and mobile apps. The Sudoku board is a 9 × 9 grid in which the player must place the digits 1 to 9 once, and only once, in each row, column, and 3 × 3 subgrid. The game begins with a few spaces already filled in with digits, called givens. A well-formed Sudoku puzzle will have only one possible valid solution.

The Program in Action

When you run sudoku.py, the output will look like this:

Sudoku Puzzle, by Al Sweigart al@inventwithpython.com
--snip-- A B C D E F G H I 1 . . . | . . . | . . . 2 . 7 9 | . 5 . | 1 8 . 3 8 . . | . . . | . . 7 ------+-------+------ 4 . . 7 | 3 . 6 ...

Get The Big Book of Small Python Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.