Skip to content
This repository was archived by the owner on Aug 11, 2023. It is now read-only.

Commit d979206

Browse files
committed
Update second example
1 parent d6988a2 commit d979206

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

README-PYTHON-HOMEWORKS.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
2. ***Solve these problems*** ([**link**](/lessons/python/exercises/exercise-general-week-04.py)) <sub>[[ANSWERS](/lessons/python/exercises/exercise-general-week-04-answer.py)]</sub>
4848
</details>
4949

50-
<details open>
50+
<details>
5151
<summary><strong>Week 5</strong></summary>
5252

5353
1. Search for these terms:
@@ -64,7 +64,7 @@
6464
- Solve ball Grid problem ([**link**](/lessons/python/exercises/exercise-general-week-05-04.py)) <sub>[[ANSWERS](/lessons/python/exercises/exercise-general-week-05-04-answer.py)]</sub>
6565
</details>
6666

67-
<details open>
67+
<details>
6868
<summary><strong>Week 6</strong></summary>
6969

7070
1. Search for these terms:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
D = [
2+
{"id": 100001, "p-num": "101", "user-meta": [
3+
{"f-name": "FirstName 1"},
4+
{"l-name": "LastName 1"},
5+
{"comp": "CompanyName 1"},
6+
{"s-num": "102"},
7+
{"s-num": "103"},
8+
{"s-num": "104"},
9+
]},
10+
{"id": 100002, "p-num": "201", "user-meta": [
11+
{"f-name": "FirstName 2"},
12+
{"l-name": "LastName 2"},
13+
]},
14+
{"id": 100003, "p-num": "301", "user-meta": [
15+
{"f-name": "FirstName 3"},
16+
{"l-name": "LastName 3"},
17+
{"s-num": "302"},
18+
]}
19+
]
20+
21+
X = {
22+
"p-num": "Primary Number",
23+
"s-num": "Number",
24+
"f-name": "First Name",
25+
"l-name": "Last Name",
26+
"comp": "Company",
27+
"id": "ID"
28+
}
29+
30+
for user in D:
31+
print("-" * 50)
32+
for key in user.keys():
33+
if key != "user-meta":
34+
print(X[key], ": ", user[key])
35+
print("------------")
36+
print("Contact Info")
37+
print("------------")
38+
for item in user["user-meta"]:
39+
for key, value in item.items():
40+
print("--->", X[key], ": ", value)

0 commit comments

Comments
 (0)