⚑ IT Wisdom My Kubernetes cluster keeps crashing. It's running in production, so that tracks.
Skilled Practitioner
4249 XP 1751 to Expert
Objective: Loop through a list of device dictionaries and print a formatted summary.
Instructions

Create a file called lab2.py. Using the inventory below, loop through every device and print one line per device in the format: name | ip | site.

inventory = [
    {"name": "sw-core-01",  "ip": "10.1.1.1",   "type": "switch", "site": "HQ"},
    {"name": "sw-access-01","ip": "10.1.1.2",   "type": "switch", "site": "HQ"},
    {"name": "rtr-edge-01", "ip": "10.1.1.254", "type": "router", "site": "HQ"},
]

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

Starter Code
inventory = [
    {"name": "sw-core-01",  "ip": "10.1.1.1",   "type": "switch", "site": "HQ"},
    {"name": "sw-access-01","ip": "10.1.1.2",   "type": "switch", "site": "HQ"},
    {"name": "rtr-edge-01", "ip": "10.1.1.254", "type": "router", "site": "HQ"},
]

for device in inventory:
    print(f"{device['name']} | {device['ip']} | {device['site']}")
πŸ’‘ Show Hint
Use an f-string: print(f"{device['name']} | {device['ip']} | {device['site']}")
Paste Your Output
Next Lab β†’