border-radius: 1008px; background: radial-gradient(67.44% 95.04% at 28.56% 81.95%, rgba(0, 10, 255, 0.60) 0%, rgba(123, 65, 255, 0.60) 61.93%, rgba(193, 166, 255, 0.60) 80.62%, rgba(114, 225, 223, 0.60) 100%); filter: blur(150px);
Gartner® Magic Quadrant™ for B2B Pricing and Rebate Optimization Read Report

9.1.6 Checkerboard — V1 Codehs

for i in range(8): # Loop through rows for j in range(8): # Loop through columns # Logic goes here Use code with caution. Step 3: Apply the Checkerboard Logic Inside the loops, you need to decide when to put a

(B = beeper, . = empty)

Some versions of the CodeHS exercise use red instead of gray. If your prompt says "red and black", simply change the color in the conditional:

for i in range(8): row = [] for j in range(8): if (i + j) % 2 == 0: row.append("R") # R for red else: row.append("B") # B for black board.append(row) 9.1.6 checkerboard v1 codehs

: Check if the row index is in the top three (0, 1, 2) or the bottom three (5, 6, 7). If it is, change those elements to 1 .

: If the sum leaves a remainder, it colors the square white . Visual Example Matrix (Row + Col) : Top-Left cell (0,0) : →right arrow Next cell right (0,1) : →right arrow First cell second row (1,0) : →right arrow Second cell second row (1,1) : →right arrow 3. Calculating Coordinates

Implementing a grid-based graphics program is a classic milestone in learning computer science. In the CodeHS JavaScript Graphics curriculum, the assignment challenges you to combine loops, nested structures, and geometric math to draw a classic checkerboard pattern on the screen. for i in range(8): # Loop through rows

The top-left square is black instead of gray. Fix: Ensure your parity logic starts with (row + col) % 2 == 0 as gray. If it's reversed, swap the colors in the if statement.

To successfully complete this exercise, you must understand the following Python concepts:

Here is the standard JavaScript / Canvas implementation used in the CodeHS Karel/Graphics environment: javascript If your prompt says "red and black", simply

while (frontIsClear()) move(); if (startWithBeeper) // Alternate pattern: after moving, we want opposite // Better approach: move, then if column index is even/odd // But simpler: use a counter

Finally, you must print the board to match the CodeHS output requirements. 4. The Final Code: 9.1.6 Checkerboard V1

board = []

Request a demo

Request your personalized demo and one of our friendly team members will be in touch with you shortly.

Please complete this field.
Please complete this field.
Please complete this field.
Please enter a valid email address.
Please enter a valid email address.
Please select an option.
Please select an option.
Please agree to our Privacy Policy.