-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.py
More file actions
37 lines (30 loc) · 723 Bytes
/
Test.py
File metadata and controls
37 lines (30 loc) · 723 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
def test(target):
i = target[0]
i, target[i] = target[i], i
return target
def testData():
while True:
data = input().strip()
if data.isspace():
print("is space")
break
else:
data = list(map(int, data.split()))
n, array = data[0], data[1:]
sum = 0
for i in range(n):
sum += array[i]
print(sum,)
def fun(source):
dic = {}
for i in source:
if i in dic:
dic[i] += 1
else:
dic[i] = 1
return dic
if __name__ == "__main__":
# testData()
dic = fun([1, 2, 5, 3, 2])
sorted(dic.items(), key=lambda e: e[1])
print(dic)