Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

We will represent the Sudoku board as a list of lists of single character strings. Start by looking at the code in check1.py. It

We will represent the Sudoku board as a list of lists of single character strings. Start by looking at the 123 2 3 4 5 6 7 8 9 10 11 12 13 14 15 bd  [  '1 I T 2 I 2 I '8 print(len (bd)) print(len (bd[0])) print

We will represent the Sudoku board as a list of lists of single character strings. Start by looking at the code in check1.py. It has an example board, stored in the variable bd. Each '.' is an empty location on the Sudoku board. The code prints the length of bd, the length of the 0-th list stored in bd, the entry in row 0, column 0, and finally the entry in row 8, column 8. Go ahead and run this code, and make sure you understand the output you are seeing. Write nested for or while loops to print the whole board on the screen. You will first go through each row with one loop, then for each row, you will go through each column using a second loop (see index range 2 from Checkpoint 0). Print each item with space on both sides, and a 1 after every third item and third row. Remember, you have exactly 9 rows and 9 columns. Here is the expected output: I 1 1.2.1.371 I. 6. | . . 5 14. | 1.5.1 129 1 1 I I . 19 41.37 11. 41 14 143. 1 1 1 1 1.17 15...8.1 128.1.4 .6 | Hint. Double loops can be difficult, so we recommend you start slowly and add complexity. This will also help you in the other parts. Start from your Checkpoint 0, step 2 code, but where you printed the indices, instead print the entry from the board bd. So if your loop variables are i and j, where you would be adding str(i)+','+str(j) to your output, instead add bd [i][j]. Now, where you add the extra blank lines between every third row, add a line of twenty-five '-'s instead. Finally, add a vertical bar | in place of the after every third column. To complete Checkpoint 1: Show a TA or Mentor your code and output once you are finished. 123 2 3 4 5 6 7 8 9 10 11 12 13 14 15 bd [ '1 I T 2 I 2 I '8 print(len (bd)) print(len (bd[0])) print (bd[0][0]) print (bd[8] [8]) '7'], '], '9'], '], '], '], '], '], '6']]

Step by Step Solution

3.51 Rating (151 Votes )

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Labor and Employment Law Text and Cases

Authors: David Twomey

15th edition

1133188281, 978-1133711841, 1133711847, 978-1285247632, 978-1133188285

More Books

Students also viewed these Programming questions