916: Checkerboard V1 Codehs Fixed
In the JavaScript and Graphics-based versions of this exercise, you typically loop through a grid of rows and columns to draw squares or toggle grid states. The Problem
The instructions require modifications only to the top 3 rows (indices ) and the bottom 3 rows (indices ). The middle two rows (indices ) must remain all
This code creates a sharp, red-and-black checkerboard where the top-left square is black.
Does your version require you to the array from a method or print it directly? Share public link 916 checkerboard v1 codehs fixed
Here is the fully functional Java code to pass the CodeHS autograder.
# --- Setup --- t = turtle.Turtle() t.speed(0) # Set speed to fastest t.hideturtle()
#CodeHS #Python #CodingHelp #TracyTheTurtle #LearnToCode #ProgrammingTips In the JavaScript and Graphics-based versions of this
To help tailor this, let me know if you need help with , need to adapt this to Python , or want to add a graphical user interface using canvas shapes. Share public link
: The program must determine the correct color for each square based on its position in the grid. Common Bugs in 9.1.6 CodeHS
color_value = color_value + 1 # NameError: name 'color_value' is not defined Does your version require you to the array
Inside a nested loop, use the mathematical property of a checkerboard: an element should be if the sum of its row and column indices is an even number . Example: At board[0][0] , (even), so it becomes Example: At board[0][1] , (odd), so it remains
Place a 0 (or your primary color).
If the row index plus the column index is an , place a colored block.
You must use board[row][col] = 1 . The autograder specifically looks for the = assignment operator being used on the list elements.