-
Notifications
You must be signed in to change notification settings - Fork 261
/
01_02e.py
71 lines (68 loc) · 1.55 KB
/
01_02e.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
from collections import Counter
def get_common_products(products_purchased):
count = Counter(products_purchased)
return count.most_common(3)
def main():
products_purchased = ["DES005",
"BEV003",
"DES004",
"DES001",
"DES002",
"DES003",
"DES002",
"DES002",
"STA004",
"SAL004",
"ENT005",
"BEV003",
"SAL002",
"ENT005",
"SAL004",
"ENT004",
"ENT004",
"DES004",
"BEV001",
"STA001",
"STA003",
"BEV002",
"STA003",
"DES005",
"BEV002",
"ENT004",
"ENT001",
"DES005",
"ENT004",
"STA005",
"ENT005",
"DES002",
"ENT001",
"SAL001",
"BEV001",
"DES002",
"BEV001",
"DES004",
"ENT004",
"DES001",
"STA005",
"DES004",
"ENT002",
"DES001",
"ENT002",
"ENT003",
"BEV001",
"DES004",
"STA005",
"STA003",
"SAL002",
"ENT001",
"SAL004",
"STA005",
"ENT002",
"DES004",
"DES004",
"SAL001",
"BEV003",
"DES001"]
print(get_common_products(products_purchased))
if __name__ == "__main__":
main()