Lab 1 of 5
Β·
Guided
Build a Device Dictionary
Objective: Create a dictionary representing a network device and access its values.
Instructions
Open python3 in your terminal. Run each line below one at a time:
device = {"name": "sw-core-01", "ip": "10.1.1.1", "type": "switch", "site": "HQ", "vlan": 10}
device["name"]
device["ip"]
device.keys()
len(device)
The first line creates the dictionary and produces no output. The next four lines each produce a result.
Paste only the four output lines below and submit.
π‘ Show Hint
The assignment line produces no output. device["name"] returns the value for that key. dict.keys() returns all keys. len() counts the number of key-value pairs.
Paste Your Output