Ex
Exerpad
🔥0
0 XP
Lv.1 Beginner

Diagonal Stripes

Read a number N from input and create an N x N grid with diagonal stripes.

Use (row + col) % 3 to pick the color:

  • 0"red"
  • 1"gold"
  • 2"orange"

Don't change the print statements at the bottom.

python
n = int(input())
colors = ["red", "gold", "orange"]
grid = []
# Create N x N grid
# Use colors[(row + col) % 3] for each cell


__grid__ = grid

# Don't change below this line
print(len(grid))
print(grid[0][0])
print(grid[0][1])
print(grid[1][1])
Exerpad — Learn to Code with Fun!