6.0 Automation
Python for Network Automation Practice Questions
Python scripting patterns for interacting with network device APIs.
One solved question, so you can see how these are marked
Given the Python variable device = {"hostname": "Router1", "interfaces": ["Gig1", "Gig2"]}, what command returns the string "Gig2"?
device["interfaces"][1]
device is a dictionary; "interfaces" returns the list ["Gig1", "Gig2"]. List indexing is zero-based, so index [1] yields "Gig2".
Every question in the set below is marked like this. The answers stay hidden until you pick one.