9.1.6 Checkerboard V1 Codehs Today
set canvas size (e.g., 400 x 400) set number of rows/cols = 8 square_size = canvas_width / 8
, which introduces different values for red and black pieces? 9.1.6 checkerboard v1 codehs
def draw_checkerboard(n, square_size, color1, color2): for r in range(n): for c in range(n): color = color1 if (r + c) % 2 == 0 else color2 draw_filled_square(x=c*square_size, y=r*square_size, size=square_size, fill=color) set canvas size (e
Output:
