A: Then you should not create a new grid . Use nested loops to set grid[r][c] = new_value directly.
for r in range(rows): new_row = [] # Inner loop will go here grid.append(new_row) For each row, the inner loop iterates over each column number from 0 to cols - 1 . Inside, we check if (r + c) % 2 == 0 to decide the color. 6.3.5 Cmu Cs Academy
Remember: the solution is not just about typing if (r+c)%2==0 . It’s about understanding the . Once you internalize that, no grid-based problem will intimidate you. A: Then you should not create a new grid
Row 0: red, blue, red, blue Row 1: blue, red, blue, red Row 2: red, blue, red, blue Notice: If (row + column) is , the cell is 'red' . If (row + column) is odd , it's 'blue' . Step 2: Set Up the Function Template In CMU CS Academy’s graphics environment, you would write: Inside, we check if (r + c) % 2 == 0 to decide the color
The course is divided into units, each with a series of exercises, checkpoints, and creative tasks. One particular checkpoint that often intrigues and challenges students is .