<jupyter_start><jupyter_text>Solution With this maze structure:<jupyter_code>house = {
    "living": {
        "exits": {"north": "kitchen", "outside": "garden", "upstairs": "bedroom"},
        "people": ["James"],
        "capacity": 2,
    },
    "kitchen": {"exits": {"south": "living"}, "people": [], "capacity": 1},
    "garden": {"exits": {"inside": "living"}, "people": ["Sue"], "capacity": 3},
    "bedroom": {
        "exits": {"downstairs": "living", "jump": "garden"},
        "people": [],
        "capacity": 1,
    },
}<jupyter_output><empty_output><jupyter_text>We can get a simpler dictionary with just capacities like this:<jupyter_code>{name: room["capacity"] for name, room in house.items()}<jupyter_output><empty_output><jupyter_text>To get the current number of occupants, we can use a similar dictionary comprehension. Remember that we can *filter* (only keep certain rooms) by adding an `if` clause:<jupyter_code>{name: len(room["people"]) for name, room in house.items() if len(room["people"]) > 0}<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18916349809885932, 'fraction_numerical': 0.004752851711026616, 'mean_word_length': 4.915730337078652, 'pattern_counts': {'":': 23, '<': 13, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '11945', 'license': 'CC-BY-3.0', 'n_tokens_mistral': 360, 'n_tokens_neox': 337, 'n_words': 94, 'path': 'module02_intermediate_python/02_00answer_maze_comprehension.ipynb', 'repo_name': 'mmlchang/rse-course', 'size': '1052'}