Skip to content

Commit 4338f67

Browse files
authored
chore(i18n,learn): processed translations (#179)
1 parent c75a1b2 commit 4338f67

File tree

880 files changed

+17600
-6650
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

880 files changed

+17600
-6650
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
id: 688f1daf0133dbe2a36b140b
3+
title: A1 Professional Chinese Certification
4+
certification: a1-professional-chinese-certification
5+
challengeType: 7
6+
isPrivate: true
7+
tests:
8+
- id: 688f1daf0133dbe2a36b140b
9+
title: "Dialogue 1: PLACEHOLDER"

curriculum/challenges/chinese-traditional/16-the-odin-project/top-build-a-recipe-project/top-build-a-recipe-project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: 6391d1a4f7ac71efd0621380
33
title: 創建一個食譜頁面項目
4-
challengeType: 14
4+
challengeType: 25
55
dashedName: top-build-a-recipe-project
66
---
77

curriculum/challenges/chinese-traditional/16-the-odin-project/top-build-a-rock-paper-scissors-game/build-a-rock-paper-scissors-game.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: 66629f407d679d3105e8317f
33
title: Build a Rock Paper Scissors Game
4-
challengeType: 14
4+
challengeType: 25
55
dashedName: top-build-a-rock-paper-scissors-game
66
---
77

curriculum/challenges/chinese-traditional/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-a.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: 63ee3f71381756f9716727ef
33
title: CSS Foundations Exercise A
4-
challengeType: 14
4+
challengeType: 25
55
dashedName: css-foundations-exercise-a
66
---
77

curriculum/challenges/chinese-traditional/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-b.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: 63ee3fe4381756f9716727f0
33
title: CSS Foundations Exercise B
4-
challengeType: 14
4+
challengeType: 25
55
dashedName: css-foundations-exercise-b
66
---
77

curriculum/challenges/chinese-traditional/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-c.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: 63ee3fe9381756f9716727f1
33
title: CSS Foundations Exercise C
4-
challengeType: 14
4+
challengeType: 25
55
dashedName: css-foundations-exercise-c
66
---
77

curriculum/challenges/chinese-traditional/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-d.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: 63ee3ff1381756f9716727f2
33
title: CSS Foundations Exercise D
4-
challengeType: 14
4+
challengeType: 25
55
dashedName: css-foundations-exercise-d
66
---
77

curriculum/challenges/chinese-traditional/16-the-odin-project/top-learn-css-foundations-projects/css-foundations-exercise-e.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: 63ee3ff8381756f9716727f3
33
title: CSS Foundations Exercise E
4-
challengeType: 14
4+
challengeType: 25
55
dashedName: css-foundations-exercise-e
66
---
77

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
---
2+
id: 686fdcfe055bcda9f651dd2e
3+
title: Build an Adjacency List to Matrix Converter
4+
challengeType: 27
5+
dashedName: build-an-adjacency-list-to-matrix-converter
6+
---
7+
8+
# --description--
9+
10+
In this lab, you will build a function that converts an adjacency list representation of a graph into an adjacency matrix. An adjacency list is a dictionary where each key represents a node, and the corresponding value is a list of nodes that the key node is connected to. An adjacency matrix is a 2D array where the entry at position `[i][j]` is `1` if there's an edge from node `i` to node `j`, and `0` otherwise.
11+
12+
For example, given the adjacency list:
13+
14+
```py
15+
{
16+
0: [1, 2],
17+
1: [2],
18+
2: [0, 3],
19+
3: [2]
20+
}
21+
```
22+
23+
The corresponding adjacency matrix would be:
24+
25+
```py
26+
[
27+
[0, 1, 1, 0],
28+
[0, 0, 1, 0],
29+
[1, 0, 0, 1],
30+
[0, 0, 1, 0]
31+
]
32+
```
33+
34+
**Objective:** Fulfill the user stories below and get all the tests to pass to complete the lab.
35+
36+
**User Stories:**
37+
38+
1. You should define a function named `adjacency_list_to_matrix` to convert an adjacency list to an adjacency matrix.
39+
2. The function should take a dictionary representing the adjacency list of an unweighted (either undirected or directed) graph as its argument.
40+
3. The function should:
41+
- Convert the adjacency list to an adjacency matrix.
42+
- Print each row in the adjacency matrix.
43+
- Return the adjacency matrix.
44+
45+
For example, `adjacency_list_to_matrix({0: [2], 1: [2, 3], 2: [0, 1, 3], 3: [1, 2]})` should print:
46+
47+
```md
48+
[0, 0, 1, 0]
49+
[0, 0, 1, 1]
50+
[1, 1, 0, 1]
51+
[0, 1, 1, 0]
52+
```
53+
54+
and return `[[0, 0, 1, 0], [0, 0, 1, 1], [1, 1, 0, 1], [0, 1, 1, 0]]`.
55+
56+
57+
# --hints--
58+
59+
You should define a function named `adjacency_list_to_matrix`.
60+
61+
```js
62+
({
63+
test: () => assert(runPython(`
64+
_Node(_code).has_function("adjacency_list_to_matrix")
65+
`))
66+
})
67+
```
68+
69+
The `adjacency_list_to_matrix` function should have one parameter.
70+
71+
```js
72+
({ test: () => assert(runPython(`
73+
import inspect
74+
sig = inspect.signature(adjacency_list_to_matrix)
75+
len(sig.parameters) == 1
76+
`))
77+
})
78+
```
79+
80+
The function should correctly determine the number of nodes from the adjacency list.
81+
82+
```js
83+
({
84+
test: () => runPython(`
85+
adj_list = {0: [1], 1: [0], 2: []}
86+
result = adjacency_list_to_matrix(adj_list)
87+
assert len(result) == 3
88+
assert len(result[0]) == 3
89+
`)
90+
})
91+
```
92+
93+
The function should correctly set matrix values to `1` for existing edges.
94+
95+
```js
96+
({
97+
test: () => runPython(`
98+
adj_list = {0: [1], 1: [0]}
99+
result = adjacency_list_to_matrix(adj_list)
100+
assert result[0][1] == 1
101+
assert result[1][0] == 1
102+
assert result[0][0] == 0
103+
assert result[1][1] == 0
104+
`)
105+
})
106+
```
107+
108+
The function should print each row of the matrix.
109+
110+
```js
111+
({
112+
test: () => runPython(`
113+
import io
114+
import sys
115+
116+
captured_output = io.StringIO()
117+
sys.stdout = captured_output
118+
119+
adj_list = {0: [1], 1: []}
120+
adjacency_list_to_matrix(adj_list)
121+
122+
sys.stdout = sys.__stdout__
123+
output = captured_output.getvalue()
124+
125+
assert "[0, 1]" in output
126+
assert "[0, 0]" in output
127+
`)
128+
})
129+
```
130+
131+
The function should return the adjacency matrix.
132+
133+
```js
134+
({
135+
test: () => runPython(`
136+
adj_list = {0: [1], 1: []}
137+
result = adjacency_list_to_matrix(adj_list)
138+
assert result == [[0, 1], [0, 0]]
139+
`)
140+
})
141+
```
142+
143+
When given the adjacency list `{0: [1, 2], 1: [2], 2: [0, 3], 3: [2]}`, the function should return `[[0, 1, 1, 0], [0, 0, 1, 0], [1, 0, 0, 1], [0, 0, 1, 0]]`.
144+
145+
```js
146+
({
147+
test: () => runPython(`
148+
adj_list = {0: [1, 2], 1: [2], 2: [0, 3], 3: [2]}
149+
result = adjacency_list_to_matrix(adj_list)
150+
expected = [[0, 1, 1, 0], [0, 0, 1, 0], [1, 0, 0, 1], [0, 0, 1, 0]]
151+
assert result == expected
152+
`)
153+
})
154+
```
155+
156+
When given the adjacency list `{0: [1], 1: [0]}`, the function should return `[[0, 1], [1, 0]]`.
157+
158+
```js
159+
({
160+
test: () => runPython(`
161+
adj_list = {0: [1], 1: [0]}
162+
result = adjacency_list_to_matrix(adj_list)
163+
expected = [[0, 1], [1, 0]]
164+
assert result == expected
165+
`)
166+
})
167+
```
168+
169+
When given the adjacency list `{0: [], 1: [], 2: []}`, the function should return `[[0, 0, 0], [0, 0, 0], [0, 0, 0]]`.
170+
171+
```js
172+
({
173+
test: () => runPython(`
174+
adj_list = {0: [], 1: [], 2: []}
175+
result = adjacency_list_to_matrix(adj_list)
176+
expected = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
177+
assert result == expected
178+
`)
179+
})
180+
```
181+
182+
# --seed--
183+
184+
## --seed-contents--
185+
186+
```py
187+
188+
```
189+
190+
# --solutions--
191+
192+
```py
193+
def adjacency_list_to_matrix(adj_list):
194+
n = len(adj_list)
195+
196+
adj_matrix = [[0] * n for _ in range(n)]
197+
198+
for src_node, neighbors in adj_list.items():
199+
for dest_node in neighbors:
200+
adj_matrix[src_node][dest_node] = 1
201+
202+
for row in adj_matrix:
203+
print(row)
204+
205+
return adj_matrix
206+
207+
adj_list = {
208+
0: [1, 2],
209+
1: [2],
210+
2: [0, 3],
211+
3: [2]
212+
}
213+
214+
matrix = adjacency_list_to_matrix(adj_list)
215+
```

curriculum/challenges/chinese-traditional/25-front-end-development/lab-availability-table/66b36358ed4f261d64840c24.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ demoType: onClick
88

99
# --description--
1010

11-
Fulfill the user stories below and get all the tests to pass to complete the lab.
11+
**Objective:** Fulfill the user stories below and get all the tests to pass to complete the lab.
1212

1313
**用戶需求:**
1414

0 commit comments

Comments
 (0)