The assignment on CodeHS is a common hurdle for many intro Python students. While it looks like a simple grid, the goal is to master nested loops and 2D lists (lists of lists) by setting specific values to represent checker pieces. The Goal You need to create an 8x8 grid where: 1s represent checker pieces. 0s represent empty squares. The top 3 rows and bottom 3 rows should be filled with 1s. The middle 2 rows (rows 3 and 4) must remain as 0s. Step-by-Step Logic
The most efficient way to determine the color of a square at position (row, col) is to check if the sum of the row and column indices is even or odd. : One color (e.g., 0 ). Odd sum ( row + col % 2 != 0 ) : The other color (e.g., 1 ). Implementation Steps 9.1.6 checkerboard v1 codehs
Proof of correctness:
Swapping row and col inside the setPosition function is the most common reason for a "sideways" or broken grid. Remember: X is Columns, Y is Rows. 0s represent empty squares
Iterate through every row and column. Use an if statement to identify the top three and bottom three rows. Step-by-Step Logic Even sum (row + col %