Ex
Exerpad
🔥0
0 XP
Lv.1 Beginner

Triangle

Read a number N from input and create an N x N grid with a right triangle.

The top-left corner is the right angle. Row i should have i + 1 green cells, the rest white.

Don't change the print statements at the bottom.

python
n = int(input())
grid = []
# Create an N x N grid
# If col <= row: "green", else: "white"


__grid__ = grid

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