-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnake10.py
34 lines (24 loc) · 814 Bytes
/
snake10.py
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
M = 10
N = 10
def printf(mat):
global M, N
for i in range(M):
if i % 2 == 0:
for j in range(N):
print(str(mat[i][j]),
end=" ")
else:
for j in range(N - 1, -1, -1):
print(str(mat[i][j]),
end=" ")
mat = [[0, 2, 3, 4, 5, 6, 7, 8, 9, 10],
[20, 0, 18, 17, 16, 15, 14, 13, 12, 11],
[21, 22, 0, 24, 25, 26, 27, 28, 29, 30],
[40, 39, 38, 0, 36, 35, 34, 33, 32, 31],
[41, 42, 43, 44, 0, 46, 47, 48, 49, 50],
[60, 59, 58, 57, 56, 0, 54, 53, 52, 51],
[61, 62, 63, 64, 65, 66, 0, 68, 69, 70],
[80, 79, 78, 77, 76, 75, 74, 0, 72, 71],
[81, 82, 83, 84, 85, 86, 87, 88, 0, 90],
[100, 99, 98, 97, 96, 95, 94, 93, 92, 0]]
printf(mat)