n | def squares(w, h, *params): | n | def squares(w, h, *squares_data): |
| screen = [['.' for i in range(w)] for j in range(h)] | | canvas = [['.' for _ in range(w)] for _ in range(h)] |
| for square in params: | | for square in squares_data: |
| X, Y, s, c = square | | x, y, s, c = square |
| for i in range(s): | | for i in range(s): |
| for j in range(s): | | for j in range(s): |
t | if 0 <= Y + i < h and 0 <= X + j < w: | t | if 0 <= x + j < w and 0 <= y + i < h: |
| screen[Y + i][X + j] = c | | canvas[y + i][x + j] = c |
| for row in screen: | | for row in canvas: |
| print(''.join(row)) | | print(''.join(row)) |