gurwindersingh commited on
Commit
4360d4c
·
1 Parent(s): 11355bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -2
app.py CHANGED
@@ -145,6 +145,21 @@ def solve(board):
145
  board[row][col]=0
146
  return False
147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
 
149
  def main():
150
  st.title('Sudoku Solver')
@@ -191,10 +206,10 @@ def main():
191
  if solve(grid):
192
  with col2:
193
  st.subheader("Sudoku Solved:")
194
- solve(grid)
195
 
196
  else:
197
- col2.write("No solution found.")
198
 
199
  if __name__ == '__main__':
200
  main()
 
145
  board[row][col]=0
146
  return False
147
 
148
+
149
+ def display(quiz):
150
+ for row in range(9):
151
+ if row % 3 == 0 and row != 0:
152
+ print("....................")
153
+
154
+ for col in range(9):
155
+ if col % 3 == 0 and col != 0:
156
+ print("|", end=" ")
157
+
158
+ if col == 8:
159
+ print(quiz[row][col])
160
+ else:
161
+ print(str(quiz[row][col]) + " ", end="")
162
+
163
 
164
  def main():
165
  st.title('Sudoku Solver')
 
206
  if solve(grid):
207
  with col2:
208
  st.subheader("Sudoku Solved:")
209
+ display(grid)
210
 
211
  else:
212
+ st.write("No solution found.")
213
 
214
  if __name__ == '__main__':
215
  main()