---
id: 686b73007fc582db0132c361
title: Step 5
challengeType: 20
dashedName: step-5
---

# --description--

You need to keep track of the shortest known distance from the start node to every other node in the graph.

To do this, create a variable named `distances` and initialize it as a list containing a single element: `INF`.  


# --hints--

You should create a variable named `distances`.

```js
({
    test: () => {
      assert(
        runPython(
          `_Node(_code).find_function("shortest_path").has_variable("distances")`
        )
      );
    }
});
```

The `distances` list should be initialized to `[INF]`.

```js
({
    test: () => {
      assert(
        runPython(
          `_Node(_code).find_function("shortest_path").find_variable("distances").is_equivalent("distances = [INF]")`
        )
      );
    }
});
```

# --seed--

## --seed-contents--

```py
INF = float('inf')
adj_matrix = [
    [0, 5, 3, INF, 11, INF],
    [5, 0, 1, INF, INF, 2],
    [3, 1, 0, 1, 5, INF],
    [INF, INF, 1, 0, 9, 3],
    [11, INF, 5, 9, 0, INF],
    [INF, 2, INF, 3, INF, 0],
]

def shortest_path(matrix, start_node, target_node=None):
    n = len(matrix)
--fcc-editable-region--
    
--fcc-editable-region--
```
