This repository was archived by the owner on Jan 2, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnit_6_part_7.py
More file actions
114 lines (109 loc) · 3.53 KB
/
Unit_6_part_7.py
File metadata and controls
114 lines (109 loc) · 3.53 KB
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
# workers = {
# 'employer1': {'name': 'Jhon', 'salary': 7500},
# 'employer2': {'name': 'Emma', 'salary': 8000},
# 'employer3': {'name': 'Brad', 'salary': 500}
# }
# for employers in workers:
# # if workers[employers]['name'] == 'Brad':
# # workers[employers]['salary'] = 8500
# # break
# # print(workers)
#
# s = input().lower()
# d = {}
# for i in s:
# if i.isalpha():
# d[i] = d.get(i, 0) + 1
# print(d)
# supermarket = {
# "milk": {"quantity": 20, "price": 1.19},
# "biscuits": {"quantity": 32, "price": 1.45},
# "butter": {"quantity": 20, "price": 2.29},
# "cheese": {"quantity": 15, "price": 1.90},
# "bread": {"quantity": 15, "price": 2.59},
# "cookies": {"quantity": 20, "price": 4.99},
# "yogurt": {"quantity": 18, "price": 3.65},
# "apples": {"quantity": 35, "price": 3.15},
# "oranges": {"quantity": 40, "price": 0.99},
# "bananas": {"quantity": 23, "price": 1.29}
# }
# check_sum = 0
# for item in supermarket:
# check_sum += (supermarket[item]['quantity']*supermarket[item]['price'])
# print(check_sum)
persons= [
('Allison Hill', 334053, 'M', '1635644202'),
('Megan Mcclain', 191161, 'F', '2101101595'),
('Brandon Hall', 731262, 'M', '6054749119'),
('Michelle Miles', 539898, 'M', '1355368461'),
('Donald Booth', 895667, 'M', '7736670978'),
('Gina Moore', 900581, 'F', '7018476624'),
('James Howard', 460663, 'F', '5461900982'),
('Monica Herrera', 496922, 'M', '2955495768'),
('Sandra Montgomery', 479201, 'M', '5111859731'),
('Amber Perez', 403445, 'M', '0602870126')
]
data = {}
for person in persons:
data[person[0]] = dict(salary=person[1],gender=person[2],passport=person[3])
data = {
"my_friends": {
"count": 10,
"people": [{
"first_name": "Kurt",
"id": 621547005,
"last_name": "Cobain",
"bdate": "31.8.2005"
}, {
"first_name": "Виолетта",
"id": 484200150,
"last_name": "Кастилио",
}, {
"first_name": "Иринка",
"id": 21886133,
"last_name": "Бушуева",
"bdate": "28.8.1942"
}, {
"first_name": "Данил",
"id": 282456573,
"last_name": "Греков",
"bdate": "4.7.2002"
}, {
"first_name": "Валентин",
"id": 184902932,
"last_name": "Долматов",
"bdate": "25.5"
}, {
"first_name": "Евгений",
"id": 620469646,
"last_name": "Шапорин",
"bdate": "6.12.1982"
}, {
"first_name": "Ангелина",
"id": 622328862,
"last_name": "Краснова",
"bdate": "4.11.1995"
}, {
"first_name": "Иван",
"id": 576015198,
"last_name": "Вирин",
"bdate": "2.2.1915"
}, {
"first_name": "Паша",
"id": 386922406,
"last_name": "Воронов",
"bdate": "27.9"
}, {
"first_name": "Ольга",
"id": 622170942,
"last_name": "Савченкова",
"bdate": "20.12"
}]
}
}
# names = []
# for friends in data['my_friends']['people']:
# names.append(friends['first_name'])
# #print(friends['first_name'])
# print(*sorted(names), sep='\n')
# print(*sorted([x.get('first_name') for x in data.get('my_friends').get('people')]), sep='\n')