Question: Programming in Python: Sudoku Validator - Load a Sudoku solution from a text file. The file contains 9 rows of 9 numbers, each number in
Programming in Python: Sudoku Validator
- Load a Sudoku solution from a text file. The file contains 9 rows of 9 numbers, each number in a line is separated by a space.
- The data must be loaded into a 2-dimensional list
- Verify that each row contains all digits 1 thru 9. If not, display each bad column and indicate the first (from left to right) bad digit in the row.
- Verify that each column contains all digits 1 thru 9. If not, display each bad row and indicate the first (from left to right) bad digit in the column.
- If the rows and columns are both good, you can print Sudoku verified
- The Sudoku solution input file name should be entered by the user
- Once the filename is entered, all processing should be done in functions. The function should be called check_sudoku and should accept a string file name parameter: check_sudoku(file_name)
- You may create multiple functions in your solution if you desire (recommended), but all processing should be initiated via the check_sudoku(file_name) call.
- The output of the analysis of the Sudoku solution will be either:
o Sudoku verified
Or one or both of the following:
o A list of bad rows o A list of bad columns o Example (fromsudoku_bad.txtinputfile):
Two test input files will be provided (sudoku_good.txt and sudoku_bad.txt). You must insure these files load and process properly. You may certainly create your own input files as well to test your program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
