cconnected.
Understand the pattern. Find your own way.Find your starting point
Your learning feed/Idea 8 of 218
Ideas this builds on
Start small08 / 218

Keep a little lookup notebook

Picture

Write “park: 5 minutes” in your notebook. Later, look up the park and find 5. A dictionary pairs a key with a value.

Predict

Our notebook says park: 5 and café: 8. What do we get by looking up park?

Let's look
  1. We use the key “park” to find its value.
A little Python, if you want it
minutes = {"park": 5, "cafe": 8}
assert minutes["park"] == 5
minutes["park"] = 6
assert minutes["park"] == 6

A key has one current value. Assigning to that key again replaces its value. A dictionary can be a saved-answer notebook, provided the key really identifies the question.

Change one rule

Walking time changes with the starting place. Is the destination alone a good key?

Let's try it

Not always. You might use (start, destination) so different journeys don’t overwrite one another.

Connect

DP will reuse saved answers. First, draw places and the paths between them.