t | def squares(width, height, *shapes): | t | def squares(w, h, *args): |
| canvas = [['.' for _ in range(width)] for _ in range(height)] | | screen = [['.' for _ in range(w)] for _ in range(h)] |
| for square in shapes: | | for square in args: |
| x, y, size, char = square | | X, Y, s, c = square |
| for row in range(y, y + size): | | for i in range(Y, Y + s): |
| if row < height: | | if i < h: |
| for col in range(x, x + size): | | for j in range(X, X + s): |
| if col < width: | | if j < w: |
| canvas[row][col] = char | | screen[i][j] = c |
| for line in canvas: | | for row in screen: |
| print(''.join(line)) | | print(''.join(row)) |