Question: function solve_sudoku(file_name) that finds the solution for the given sudoku. Input: a file name file name, where the file contains n lines, and each line

function solve_sudoku(file_name) that finds the solution for the given sudoku.

Input: a file name file name, where the file contains n lines, and each line contains n entries separated by commas. Each entry will either be a positive integer, or the letter 'x'.

Output: a nested list representing a completed sudoku grid. You may assume the file given will always contain exactly one valid solution.

File gridA.txt contains:

x,x,1,x

4,x,x,x

x,x,x,2

x,3,x,x

File gridB.txt contains:

1,x,9,x,x,x,x,6,x

8,4,x,x,1,x,x,7,5

x,x,2,x,x,3,x,x,4

x,x,8,3,2,1,x,4,7

x,x,5,x,x,x,6,x,x

4,2,x,6,9,5,8,x,x

7,x,x,1,x,x,4,x,x

6,9,x,x,8,x,x,5,3

x,5,x,x,x,x,7,x,9

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!