For any given square at row r and column c (using 0-indexed tracking): x position = c * Square Size y position = r * Square Size 2. The Alternating Color Formula
: The create_rectangle function requires the top-left coordinate and the bottom-right coordinate
If you want to modify this program or test alternative patterns, let me know:
Using helper functions (CodeHS libraries):
When submitting this code to the CodeHS autograder, watch out for these frequent mistakes:
Once all columns for a row are determined, row_list is appended to the board . After the loops complete, the finished 8x8 board is passed to the print_board function to display the output.
: Within nested loops, check if the current row index is part of the top three (indices 0–2) or bottom three (indices 5–7). If so, change the 0 to a 1 using an assignment statement like board[i][j] = 1 . Step-by-Step Implementation
Most CodeHS versions of this exercise use the Grid class or a simple graphics library. Below is the standard structural approach using nested for loops. javascript
def create_checkerboard(): # Create the main window win = Window() win.set_background("white")