⚑ IT Wisdom My Docker containers are running perfectly. The application inside them is a different conversation.
Skilled Practitioner
4249 XP 1751 to Expert
Objective: Use collections.Counter to tally device types and print the most common.
Instructions

Create a file called lab4.py. Using the inventory below, extract the device types and count them using Counter. Print the full count and the most common type.

inventory = [
    {"name": "sw-core-01",   "type": "switch"},
    {"name": "sw-access-01", "type": "switch"},
    {"name": "sw-access-02", "type": "switch"},
    {"name": "rtr-edge-01",  "type": "router"},
    {"name": "rtr-branch-01","type": "router"},
    {"name": "fw-dmz-01",    "type": "firewall"},
    {"name": "ap-office-01", "type": "ap"},
]

Your output must match exactly:

switch: 3
router: 2
firewall: 1
ap: 1
Most common: switch (3)

Run it with python3 lab4.py. Paste your output below and submit.

πŸ’‘ Show Hint
types = [d["type"] for d in inventory]. counts = Counter(types). Loop: for device_type, count in counts.most_common(): ... Then use counts.most_common(1)[0] to get the top result.
Paste Your Output
Next Lab β†’