9.1.7 Checkerboard V2 Answers //top\\ -
for row in range(size): for col in range(size): if (row + col) % 2 == 0: set color1 else: set color2 draw cell at (row, col)
public void run() // Create a 2D array to store colors Color[][] checkerboard = new Color[ROWS][COLS]; 9.1.7 checkerboard v2 answers
Inside the inner loop, use an if/else statement combined with the modulo operator ( % ) to check if the sum of the row and column is even or odd. javascript for row in range(size): for col in range(size):