9.1.7 Checkerboard V2 Answers
A more concise way to build the grid is to alternate the entire row based on whether the row index is even or odd.
The exercise in the CodeHS Introduction to Python curriculum requires students to generate an 8x8 grid of alternating 0s and 1s using 2D lists and nested loops. Core Problem & Logic The goal is to create a list of lists where: 9.1.7 checkerboard v2 answers
Color color1 = getColorFromUser("First color: "); Color color2 = getColorFromUser("Second color: "); // Then inside the loop: if ((row+col)%2==0) { square.setFillColor(color1); } else { square.setFillColor(color2); } A more concise way to build the grid
Example of incorrect pattern (no offset): Color color2 = getColorFromUser("Second color: ")
public void run() { int n = readInt("Size: "); for (int i = 0; i < n; i++) { drawRow(i, n); } }