2/38
Part 1 of 7 · TreesLearn

A tree is a dict of children

A travel site files its listings under regions, and regions sit inside bigger regions. That's the example for this whole lesson.

Regions inside regions
Europe
Portugal
Lisbon District
Lisbon
Sintra
Cascais
Porto District
Porto
Spain
Andalusia
Seville
Granada
Catalonia

Each region sits directly inside exactly one other, except Europe, which sits inside none. Follow the regions upward from any one of them and you always end at Europe. That shape is a tree.

Predict

Portugal's subtree is Portugal with everything below it. How many regions does it hold?

Pick an answer above to see the rest