-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
119 lines (103 loc) · 3.24 KB
/
test.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# import random
# # test_list = [[random.randint(0,3) for i in range(3)] for i in range(100)]
# # for i in test_list:
# # print(i)
# # test_list_sorted = sorted(test_list, key = lambda x: (x[0],x[2], x[1]))
# # print("=====================")
# # for i in test_list_sorted:
# # print(i)
# test_list = [[random.randint(0,3) for i in range(3)] for i in range(3)]
# for row in test_list:
# print(row)
# print("=====================")
# # print(list(zip(*test_list[::-1])))
# new_list = list(zip(*test_list[::1]))
# for row in new_list:
# print(row)
# print("=====================")
# # print(list(zip(*test_list)))
# # test_col = list(zip(*test_list))
# # print(test_col)
# # print("=====================")
# # print(list(zip(*test_col)))
# # test_list = [1,23,-1, -2, 10, 9, 123]
# # print([test for test in test_list if test > 0])
# input = [
# [2, 2, -1, 3, 1],
# [-2, -2, 2, 0, -1],
# [-2, -1, -2, 1, 2],
# [-1, -2, 1, 3, 2],
# [-2, -2, 2, 2, 1]]
# input = [
# (-2, -1, -2, -2, 2),
# (-2, -2, -2, -2, 2),
# (2, 1, -2, 2, -1),
# (2, 3, 1, 0, 3),
# (1, 2, 2, -1, 1),
# ]
# input_column = list(zip(*input[::-1]))
# for i in input_column:
# print(i)
# for column in input_column:
# list_of_black = [i for i in range(len(column)) if column[i] == -1]
# # list_of_black = [i for i in input_column if i == -1]
# print("=================")
# print(column)
# if(len(list_of_black) > 0):
# i = 0
# new_row = []
# for black_index in list_of_black:
# sliced_row = list(column[i:black_index])
# sliced_new_row = [node for node in sliced_row if node > -2]
# sliced_new_row += [-2 for i in range(len(sliced_row)-len(sliced_new_row))]
# new_row += sliced_new_row
# i = black_index
# sliced_row = sliced_row = list(column[i:])
# sliced_new_row = [node for node in sliced_row if node > -2]
# sliced_new_row += [-2 for i in range(len(sliced_row)-len(sliced_new_row))]
# new_row += sliced_new_row
# print(new_row)
# direction_list = [(-1,0),(1,0),(0,-1),(0,1)]
# def make_student_spare_map_dict(N):
# student_spare_map = dict()
# for y in range(N):
# for x in range(N):
# cnt = 0
# for direction in direction_list:
# next_y = y+direction[0]
# next_x = x+direction[1]
# if not next_y < 0 and not next_x < 0 and not next_y >= N and not next_x >= N:
# cnt += 1
# student_spare_map[(y,x)] = cnt
# return student_spare_map
# # print(make_student_spare_map_dict(3))
# result = make_student_spare_map_dict(3)
# items = result.items()
# print(items)
# items_sorted = sorted(items, key = lambda x : (-x[1], x[0][0], x[0][1]))
# print(items_sorted)
# result.clear()
# print(result)
# import math
# print(math.pow(10,0))
# a = [[3,1,4],[2,5,6],[2,7,9]]
# for i in a:
# print(i)
# b = [a[i][:2] for i in range(2)]
# # for row in b:
# # print(row)
# new_b = list(map(list, zip(*b[::-1])))
# # print("dd")
# # for row in new_b:
# # print(row)
# a[0:2][0:2] = new_b
# for i in a:
# print(i)
a = dict()
a[1] = 32
a[4] = 2
a[3] = 3
print(sorted(a.keys(), reverse=True))
for i in sorted(a.keys(), reverse=True):
del(a[i])
print(a)