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