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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started