ython program. The sample of sudoko file is: �]q(]q(KKKKKKKKK e]q(KKKKKKKKKe]q(KKKKKKKKKe]q(KKKKKKK KKe]q(KKKKK KKKKe]q(KKK KKKKKKe]q(KKKKKKKKKe]q(KKKKKKKKKe]q (K KKKKKKKKee. IN form of text: 0 4 0 0 0 0 1 7 9 0 0 2 0 0 8 0 5 4 0 0 6 0 0 5 0 0 8 0 8 0 0 7 0 9 1 0 0 5 0 0 9 0 0 3 0 0 1 9 0 6 0 0 4 0 3 0 0 4 0 0 7 0 0 5 7 0 1 0 0 2 0 0 9 2 8 0 0 0 0 6 0 """ Your program should read in a pickle file that encodes a sudoku puzzle, print out a puzzle, and analyze possible answers for a given coordinate (x,y). $python3 sudoku.py sudokus/s01a.p1 3 5 answer.csv $python3 sudoku.py sudokus/s01a.p1 0 1 answer.csv """ The output to the terminal contains these parts: The sudoku puzzle that you retrieved from s01a.p1 file (argv[1]). 0 represents unsolved cell. The contents in the puzzle of row (row id comes from command line argv[2]). The contents in the puzzle of column (column id comes from command line argv[3]). The contents of the 3*3 square that the (row, column) cell is in, concatenating three rows into one list of 9 numbers. The (row, column) coordinates and its possible answers. The answers are list of numbers 1-9 that is not already in its row/column/square. Have the answers sorted from smallest to largest if there are more than one. If the (row, column) is in a cell that already has a non-zero answer, then the answer printed here should just be a list with a single number that is already there. For example see the second sample run's command line and output. Your program should also write to a csv file (argv[4]) the following data. It should contain three columns: row,column,numbers; and each row should contain the row/column coordinates for an unsolved cell with the list of possible numbers that can go in that cell. And the cells are in order of traversing row 0, then row 1, ane etc
Python program. The sample of sudoko file is:
�]q(]q(KKKKKKKKK e]q(KKKKKKKKKe]q(KKKKKKKKKe]q(KKKKKKK KKe]q(KKKKK KKKKe]q(KKK KKKKKKe]q(KKKKKKKKKe]q(KKKKKKKKKe]q (K KKKKKKKKee.
IN form of text:
0 4 0 0 0 0 1 7 9
0 0 2 0 0 8 0 5 4
0 0 6 0 0 5 0 0 8
0 8 0 0 7 0 9 1 0
0 5 0 0 9 0 0 3 0
0 1 9 0 6 0 0 4 0
3 0 0 4 0 0 7 0 0
5 7 0 1 0 0 2 0 0
9 2 8 0 0 0 0 6 0
The output to the terminal contains these parts:
- The sudoku puzzle that you retrieved from s01a.p1 file (argv[1]). 0 represents unsolved cell.
- The contents in the puzzle of row (row id comes from command line argv[2]).
- The contents in the puzzle of column (column id comes from command line argv[3]).
- The contents of the 3*3 square that the (row, column) cell is in, concatenating three rows into one list of 9 numbers.
- The (row, column) coordinates and its possible answers. The answers are list of numbers 1-9 that is not already in its row/column/square. Have the answers sorted from smallest to largest if there are more than one. If the (row, column) is in a cell that already has a non-zero answer, then the answer printed here should just be a list with a single number that is already there. For example see the second sample run's command line and output.
Your program should also write to a csv file (argv[4]) the following data. It should contain three columns: row,column,numbers; and each row should contain the row/column coordinates for an unsolved cell with the list of possible numbers that can go in that cell. And the cells are in order of traversing row 0, then row 1, ane etc.
Step by step
Solved in 2 steps