DrawSquare/timur | DrawSquare/meacca | ||||
---|---|---|---|---|---|
t | 1 | def squares(h, w, *args): | t | 1 | def squares(w, h, *args): |
2 | plot = [['.' for _ in range(h)] for _ in range(w)] | 2 | arr = [['.' for _ in range(w)] for _ in range(h)] | ||
3 | for arg in args: | 3 | for square in args: | ||
4 | (x, y, s, c) = arg | 4 | (x, y, s, c) = square | ||
5 | for x_coord in range(x, x + s): | 5 | for i in range(y, y + s): | ||
6 | for y_coord in range(y, y + s): | 6 | for j in range(x, x + s): | ||
7 | plot[y_coord][x_coord] = c | 7 | arr[i][j] = c | ||
8 | for line in plot: | 8 | for row in arr: | ||
9 | print(''.join(line)) | 9 | print(''.join(row)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|