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

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter5: Looping
Section: Chapter Questions
Problem 20RQ
Question

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

"""
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.

When you run your program, you will supply the following
command line arguments:
$ python3 sudoku.py sudokus/s01a.p1 3 5 answer_s01a.csv
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 19 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
row 3: [0, 8, 0, 0, 7, 0, 9, 1,
column 5: [О, 8, 5, 0, 0, 0, 0,
0]
0, 0]
square: [0, 7, 0, 0, 9, 0, 0, 6, 0]
(3, 5) [2, 3, 4]
$ python3 sudoku.py sudokus/s02a.p1 0 0 answer_s02a.csv
2 0 6 0 0 0 0 4 9
0 3 7 0 0 9 0 0 0
1 0 0 7 0 0 0 0 6
0 0 0 5 8 0 9 0 0
7 0 5 0 0 0 8 0 4
0 0 9 0 6 2 0 0 0
9 0 0 0 0 4 0 0 1
0 0 0 3 0 0 4 9 0
4 1 0 0 0 0 2 0 8
row 0: [2, 0, 6, 0, 0, 0, 0, 4,
column 0: [2, 0, 1, 0, 7, 0, 9,
9]
0, 4]
square: [2, 0, 6, 0, 3, 7, 1, 0, 0]
(0, 0) [2]
Transcribed Image Text:When you run your program, you will supply the following command line arguments: $ python3 sudoku.py sudokus/s01a.p1 3 5 answer_s01a.csv 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 19 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 row 3: [0, 8, 0, 0, 7, 0, 9, 1, column 5: [О, 8, 5, 0, 0, 0, 0, 0] 0, 0] square: [0, 7, 0, 0, 9, 0, 0, 6, 0] (3, 5) [2, 3, 4] $ python3 sudoku.py sudokus/s02a.p1 0 0 answer_s02a.csv 2 0 6 0 0 0 0 4 9 0 3 7 0 0 9 0 0 0 1 0 0 7 0 0 0 0 6 0 0 0 5 8 0 9 0 0 7 0 5 0 0 0 8 0 4 0 0 9 0 6 2 0 0 0 9 0 0 0 0 4 0 0 1 0 0 0 3 0 0 4 9 0 4 1 0 0 0 0 2 0 8 row 0: [2, 0, 6, 0, 0, 0, 0, 4, column 0: [2, 0, 1, 0, 7, 0, 9, 9] 0, 4] square: [2, 0, 6, 0, 3, 7, 1, 0, 0] (0, 0) [2]
The result of answer_s02a.csv should look like this:
row, column,numbers
0,1,"[5, 8]"
0,3,"[1, 8]"
0,4,"[1, 3, 5]"
0,5,"[1, 3, 5, 8]'
0,6,"[1, 3, 5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"[1, 3, 5, 7]" 5,8,"[3, 5, 7]"
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
InputStream
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage