Exercise: Maze Population

Take your maze data structure.

Write a program to count the total number of people in the maze, and also determine the total possible occupants.

If you are not happy to use the maze data structure you created in the module Data Structures, you can use the Maze Model solution: Maze Model Solution

If we re-call the cities and residents example:

cities = [{'name': "London", "capacity": 8, "residents": ["Me","Sue"]},
 {'name': "Edinburgh", "capacity": 1, "residents": ["Dave"]},
 {'name': "Cardiff", "capacity": 1, "residents": []}]

we were able to discover the number of residents in a specific city

len(cities[2]['residents'])
0

Next: Assessment - Iteration Quiz