bitprj / curriculum

Democratizing Technical Education 🐮
https://bitproject.org/curriculum
MIT License
57 stars 19 forks source link

Module4_Lab6_Sudoku_Solver: 111md #352

Closed bitscott1102 closed 4 years ago

bitscott1102 commented 4 years ago
  1. print("------|-------|-------") should be for row 3 and row 7. So this is probably not right:

if row_index % 3 == 0 and row_index != 0: print("------|-------|-------")

  1. | should appear in columns 3 and 7. So this is probably not right:

if index % 3 == 0 and index != 0: rowString += "| "

sarahg500 commented 4 years ago

When fixing this make sure you run the code and make sure

JeffTheAggie commented 4 years ago

I'm kinda confused on what the problem is for this one because when I used the sample grid (grid = [[9,4,0,0,2,0,7,0,0], [0,0,1,0,0,4,0,0,9], [0,0,6,0,0,0,1,2,0], [0,0,0,0,0,3,0,1,0],[1,0,0,0,0,0,0,0,8], [0,7,0,5,0,0,0,0,0], [0,8,7,0,0,0,2,0,0], [6,0,0,9,0,0,3,0,0], [0,0,9,0,8,0,0,5,7]]) that was defined in the first hard card, calling the printGrid() function prints the grid out correctly with the correct format. Each "" indicates the zeroes in the empty space for the grid that we're supposed to fill in. Whenever I change the if statement for the 2nd for loop in the code to a different number (if element == 0: rowString += " ") it leaves in all of the zeroes and replaces the number based on what value I set element equal to.