...

Chapter 13 - Python Quest

Mini Sudoku Project

Read a 4-by-4 grid, enforce its rules, and build a console solver with backtracking.

XP
0Level 1
Stars
0/15quest stars
Combo
0clean runs
Rank
Seed0/160 Python score
Rows and missing values

Sudoku Row Detective

100 XP

A tiny puzzle console has smudged some squares into zeroes. Before it can repair a whole Sudoku, it needs a detective who can report which digits are absent from one row.

Write missing_row_digits(row) so it returns an ascending list of the digits from 1 through 4 that do not appear in row. Zero marks an empty square and is not a Sudoku digit. Do not change row.

Sample checks

missing_row_digits([1,0,3,0])returns[2,4]

Explanation: the visible digits are 1 and 3, so comparing them with the complete set 1, 2, 3, 4 leaves 2 and 4 in ascending order

missing_row_digits([0,0,0,0])returns[1,2,3,4]

Explanation: all four squares are blank zeroes, so none of the real Sudoku digits has been used and every digit from 1 through 4 is missing

Hint

Hints are ready when you want one.

Lesson reference

Review: Compare a row with the allowed digits

Your Python

missing_row_digits

Loading editor

Judge

Ready

0/4

Run your code when it feels ready.