200-901 · Question #89
Refer to the exhibit. What is the function of the python script?
The correct answer is E. Loop through the returned list of network devices and, for each device, print the device name. The script loops through a list of network devices and prints only the device name for each entry in the list.
Question
Refer to the exhibit. What is the function of the python script?
Exhibit
Options
- ACount and print the total number of available devices.
- BIterate over a list of network devices and write all device names and management IP addresses
- CIterate over a list of network devices and write all device type and associated management IP
- DFor each device that is returned, display the device and, for each device, print the device name
- ELoop through the returned list of network devices and, for each device, print the device name
How the community answered
(36 responses)- C6% (2)
- D3% (1)
- E92% (33)
Why each option
The script loops through a list of network devices and prints only the device name for each entry in the list.
The script does not count or accumulate a total number of devices - it iterates and prints an attribute per device.
The script does not write both device names and management IP addresses - only the device name is referenced in the loop body.
The script does not print device type or management IP - those fields are not accessed within the loop.
This option is imprecise and redundant - it conflates the outer iteration with the inner print action without correctly identifying the attribute being printed.
The script uses a for loop to iterate over a returned list of network devices. For each iteration, it accesses only the device name attribute and prints it, making option E the most accurate and complete description of the script's behavior.
Concept tested: Python iteration over network device list
Source: https://developer.cisco.com/docs/dna-center/
Topics
Community Discussion
No community discussion yet for this question.
