mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-02-26 17:01:40 -05:00
chore(curriculum): remove pyodide from shortest path algorithm project (#54756)
Co-authored-by: Dario-DC <105294544+Dario-DC@users.noreply.github.com>
This commit is contained in:
@@ -23,7 +23,7 @@ Add a new key-value pair to your dictionary. Use the string `species` as the key
|
||||
You should add a new key-value pair to your `copper` dictionary.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
len(copper) == 1
|
||||
`))
|
||||
})
|
||||
@@ -32,7 +32,7 @@ You should add a new key-value pair to your `copper` dictionary.
|
||||
You should have a `species` key with the value `guinea pig` inside your `copper` dictionary.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
copper == {"species": "guinea pig"}
|
||||
`))
|
||||
})
|
||||
|
||||
@@ -14,7 +14,7 @@ Now, replace the existent keys with the strings `A` and `B` — one for each nod
|
||||
Your dictionary should have an `A` key.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
"A" in my_graph
|
||||
`))
|
||||
})
|
||||
@@ -23,7 +23,7 @@ Your dictionary should have an `A` key.
|
||||
Your `A` key should have `B` as the value.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
my_graph["A"] == "B"
|
||||
`))
|
||||
})
|
||||
@@ -32,7 +32,7 @@ Your `A` key should have `B` as the value.
|
||||
Your dictionary should have an `B` key.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
"B" in my_graph
|
||||
`))
|
||||
})
|
||||
@@ -41,7 +41,7 @@ Your dictionary should have an `B` key.
|
||||
Your `B` key should have `A` as the value.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
my_graph["B"] == "A"
|
||||
`))
|
||||
})
|
||||
@@ -50,7 +50,7 @@ Your `B` key should have `A` as the value.
|
||||
Your dictionary should have two keys.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
len(my_graph) == 2
|
||||
`))
|
||||
})
|
||||
|
||||
@@ -16,7 +16,7 @@ Modify your existing dictionary to represent this arrangement. Use a list to rep
|
||||
Your dictionary should have 3 keys — `A`, `B`, and `C`.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
key_list = ["A", "B", "C"]
|
||||
len(my_graph) == 3 and all(key in my_graph for key in key_list)
|
||||
`))
|
||||
@@ -26,7 +26,7 @@ Your dictionary should have 3 keys — `A`, `B`, and `C`.
|
||||
`my_graph["A"]` should have the `B` node as the value.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
my_graph["A"] == "B"
|
||||
`))
|
||||
})
|
||||
@@ -35,7 +35,7 @@ Your dictionary should have 3 keys — `A`, `B`, and `C`.
|
||||
`my_graph["B"]` should be a list.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
type(my_graph["B"]) is list
|
||||
`))
|
||||
})
|
||||
@@ -44,7 +44,7 @@ Your dictionary should have 3 keys — `A`, `B`, and `C`.
|
||||
The value of `my_graph["B"]` should be a list containing the other two nodes.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
len(my_graph["B"]) == 2 and "A" in my_graph["B"] and "C" in my_graph["B"]
|
||||
`))
|
||||
})
|
||||
@@ -53,7 +53,7 @@ The value of `my_graph["B"]` should be a list containing the other two nodes.
|
||||
The value of `my_graph["C"]` should be the connected node.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
my_graph["C"] == "B"
|
||||
`))
|
||||
})
|
||||
|
||||
@@ -14,7 +14,7 @@ Add one last node, `D`, which is connected with `A` and `C`. Modify your diction
|
||||
Your dictionary should have 4 keys called `A`, `B`, `C`, and `D`.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
key_list = ["A", "B", "C", "D"]
|
||||
len(my_graph) == 4 and all(key in my_graph for key in key_list)
|
||||
`))
|
||||
@@ -24,7 +24,7 @@ Your dictionary should have 4 keys called `A`, `B`, `C`, and `D`.
|
||||
`my_graph["A"]` should be a list.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
type(my_graph["A"]) is list
|
||||
`))
|
||||
})
|
||||
@@ -33,7 +33,7 @@ Your dictionary should have 4 keys called `A`, `B`, `C`, and `D`.
|
||||
`my_graph["A"]` should be a list containing `B` and `D`.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
len(my_graph["A"]) == 2 and "B" in my_graph["A"] and "D" in my_graph["A"]
|
||||
`))
|
||||
})
|
||||
@@ -42,7 +42,7 @@ Your dictionary should have 4 keys called `A`, `B`, `C`, and `D`.
|
||||
`my_graph["B"]` should be a list.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
type(my_graph["B"]) is list
|
||||
`))
|
||||
})
|
||||
@@ -51,7 +51,7 @@ Your dictionary should have 4 keys called `A`, `B`, `C`, and `D`.
|
||||
`my_graph["B"]` should be a list containing `A` and `C`.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
len(my_graph["B"]) == 2 and "A" in my_graph["B"] and "C" in my_graph["B"]
|
||||
`))
|
||||
})
|
||||
@@ -60,7 +60,7 @@ Your dictionary should have 4 keys called `A`, `B`, `C`, and `D`.
|
||||
`my_graph["C"]` should be a list.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
type(my_graph["C"]) is list
|
||||
`))
|
||||
})
|
||||
@@ -69,7 +69,7 @@ Your dictionary should have 4 keys called `A`, `B`, `C`, and `D`.
|
||||
`my_graph["C"]` should be a list containing `B` and `D`.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
len(my_graph["C"]) == 2 and "B" in my_graph["C"] and "D" in my_graph["C"]
|
||||
`))
|
||||
})
|
||||
@@ -78,7 +78,7 @@ Your dictionary should have 4 keys called `A`, `B`, `C`, and `D`.
|
||||
`my_graph["D"]` should be a list.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
type(my_graph["D"]) is list
|
||||
`))
|
||||
})
|
||||
@@ -87,7 +87,7 @@ Your dictionary should have 4 keys called `A`, `B`, `C`, and `D`.
|
||||
`my_graph["D"]` should be a list containing `A` and `C`.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
len(my_graph["D"]) == 2 and "A" in my_graph["D"] and "C" in my_graph["D"]
|
||||
`))
|
||||
})
|
||||
|
||||
@@ -28,7 +28,7 @@ Modify `my_graph["A"]` into a list of tuples, considering the following distance
|
||||
Your dictionary should have 4 keys called `A`, `B`, `C`, and `D`.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
key_list = ["A", "B", "C", "D"]
|
||||
len(my_graph) == 4 and all(key in my_graph for key in key_list)
|
||||
`))
|
||||
@@ -38,7 +38,7 @@ Your dictionary should have 4 keys called `A`, `B`, `C`, and `D`.
|
||||
`my_graph["A"]` should be a list of tuples.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
type(my_graph["A"]) is list and all(type(i) is tuple for i in my_graph["A"])
|
||||
`))
|
||||
})
|
||||
@@ -47,7 +47,7 @@ Your dictionary should have 4 keys called `A`, `B`, `C`, and `D`.
|
||||
`my_graph["A"]` should be a list of tuples where the first item in the tuple is the connected node and the second item is the distance.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
tuples = [("B", 3), ("D", 1)]
|
||||
len(my_graph["A"]) == 2 and all(t in my_graph["A"] for t in tuples)
|
||||
`))
|
||||
|
||||
@@ -16,7 +16,7 @@ Declare an empty function called `shortest_path` and don't forget the `pass` key
|
||||
You should have a `shortest_path` function.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
import inspect
|
||||
inspect.isfunction(shortest_path)
|
||||
`))
|
||||
|
||||
@@ -16,7 +16,7 @@ For that your function needs two parameters: `graph`, and `start`. Add them to y
|
||||
Your function should accept `graph` and `start` as the parameters, in this order.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
import inspect
|
||||
sig = str(inspect.signature(shortest_path))
|
||||
sig == '(graph, start)'
|
||||
|
||||
@@ -22,7 +22,7 @@ Your function should take three parameters:`graph`, `start`, and `target`. The o
|
||||
The `target` parameter should have the default value of an empty string.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
import inspect
|
||||
sig = str(inspect.signature(shortest_path))
|
||||
sig == "(graph, start, target='')"
|
||||
|
||||
@@ -14,7 +14,7 @@ Now modify `my_graph["B"]` into a list of tuples. The `B-C` distance is `4`.
|
||||
`my_graph["B"]` should be a list of tuples.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
type(my_graph["B"]) is list and all(type(i) is tuple for i in my_graph["B"])
|
||||
`))
|
||||
})
|
||||
@@ -23,7 +23,7 @@ Now modify `my_graph["B"]` into a list of tuples. The `B-C` distance is `4`.
|
||||
`my_graph["B"]` should be a list of tuples where the first item in the tuple is the connected node and the second item is the distance.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
tuples = [("A", 3), ("C", 4)]
|
||||
len(my_graph["B"]) == 2 and all(t in my_graph["B"] for t in tuples)
|
||||
`))
|
||||
|
||||
@@ -14,7 +14,7 @@ In the same way, modify the remaining two lists considering that the `C-D` dista
|
||||
`my_graph["C"]` should be a list of tuples.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
type(my_graph["C"]) is list and all(type(i) is tuple for i in my_graph["C"])
|
||||
`))
|
||||
})
|
||||
@@ -23,7 +23,7 @@ In the same way, modify the remaining two lists considering that the `C-D` dista
|
||||
`my_graph["C"]` should be a list of tuples where the first item in the tuple is the connected node and the second item is the distance.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
tuples = [("B", 4), ("D", 7)]
|
||||
len(my_graph["C"]) == 2 and all(t in my_graph["C"] for t in tuples)
|
||||
`))
|
||||
@@ -33,7 +33,7 @@ In the same way, modify the remaining two lists considering that the `C-D` dista
|
||||
`my_graph["D"]` should be a list of tuples.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
type(my_graph["D"]) is list and all(type(i) is tuple for i in my_graph["D"])
|
||||
`))
|
||||
})
|
||||
@@ -42,7 +42,7 @@ In the same way, modify the remaining two lists considering that the `C-D` dista
|
||||
`my_graph["D"]` should be a list of tuples where the first item in the tuple is the connected node and the second item is the distance.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
tuples = [("A", 1), ("C", 7)]
|
||||
len(my_graph["D"]) == 2 and all(t in my_graph["D"] for t in tuples)
|
||||
`))
|
||||
|
||||
@@ -25,7 +25,7 @@ Now, you are going to test your function with another graph. Change `my_graph` i
|
||||
You should modify `my_graph` into the provided graph.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
g = {
|
||||
'A': [('B', 5), ('C', 3), ('E', 11)],
|
||||
'B': [('A', 5), ('C', 1), ('F', 2)],
|
||||
|
||||
@@ -27,7 +27,7 @@ You should have a variable called `copper`.
|
||||
Your `copper` variable should have the value of an empty dictionary. Use a pair of curly braces for that.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
copper == {}
|
||||
`))
|
||||
})
|
||||
|
||||
@@ -16,7 +16,7 @@ Add another key `age` to your dictionary and give it the integer number `2` as v
|
||||
You should add a new key-value pair to your `copper` dictionary.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
len(copper) == 2
|
||||
`))
|
||||
})
|
||||
@@ -25,7 +25,7 @@ You should add a new key-value pair to your `copper` dictionary.
|
||||
You should have an `age` key with the value `2` just after `'species': 'guinea pig'`, inside your `copper` dictionary. Don't forget the comma.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
copper == {"species": "guinea pig", "age": 2}
|
||||
`))
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@ After your dictionary, follow the example above to access the `species` key of `
|
||||
You should not modify your dictionary.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
copper == {"species": "guinea pig", "age": 2}
|
||||
`))
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@ You should rename your `copper` dictionary into `my_graph`.
|
||||
Your `my_graph` variable should be a dictionary.
|
||||
|
||||
```js
|
||||
({ test: () => assert(__pyodide.runPython(`
|
||||
({ test: () => assert(runPython(`
|
||||
type(my_graph) is dict
|
||||
`))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user