-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Expand file tree
/
Copy pathmouredev.py
More file actions
37 lines (32 loc) · 940 Bytes
/
Copy pathmouredev.py
File metadata and controls
37 lines (32 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'''
Matriz 5 filas x 5 columnas
(0, 0) (0, 1) (0, 2) (0, 3) (0, 4)
(1, 0) (1, 1) (1, 2) (1, 3) (1, 4)
(2, 0) (2, 1) (2, 2) (2, 3) (2, 4)
(3, 0) (3, 1) (3, 2) (3, 3) (3, 4)
(4, 0) (4, 1) (4, 2) (4, 3) (4, 4)
'''
def draw_spiral(size):
for row in range(0, size):
spiral = ""
horizontal = row == 0
for col in range(0, size):
if row + col == size - 1:
spiral += "╗" if col >= row else "╚"
horizontal = col < row
elif row - col == 1 and row < (size / 2):
spiral += "╔"
horizontal = True
elif row == col and row >= (size / 2):
spiral += "╝"
horizontal = False
else:
spiral += "═" if horizontal else "║"
print(spiral)
draw_spiral(0)
draw_spiral(1)
draw_spiral(2)
draw_spiral(3)
draw_spiral(5)
draw_spiral(20)
draw_spiral(50)