Automation, Orchestration, and Scripting
An administrator is writing a script that must quickly find the IP address assigned to a given hostname, such as web01, from a collection of 50 host entries. Which data structure is best suited to this lookup?
Show the answer
Correct answerB. A dictionary with hostnames as keys
A dictionary maps keys to values, so hosts['web01'] returns the address directly. A list of IP strings is tempting, but it has no link between a name and an address, so the script would need to search by position.