What's changed: Initial version
6.1Python building blocks and interpreting a script
Treats Python's building blocks—variables, lists, dictionaries, loops, conditionals, and functions—not as syntax to memorize but as tools for reading what the script in front of you does and where it is wrong. You will learn to diagnose the network-automation staple of "iterate a device inventory and act only on matching devices" through its classic breaking points: indentation, missing keys, and return values.
When Python appears in ENCOR's domain 6, what is expected is not implementation skill as a programmer but reading skill as an operator. The exam does not ask "what is a variable"; it presents a dozen-odd lines of a script and asks you to predict its output or point out why it does not behave as intended. Automation scripts are remarkably formulaic: nearly all share the skeleton "iterate a device inventory (a list), inspect each device's attributes (a dictionary), and act only on those matching a condition." Once you hold that skeleton, and build the habit of checking three breaking points—whether the indentation places a line inside or outside the loop, whether the dictionary really has that key, and whether the function returns a value—you can reason about a script you have never seen.
6.1.1Elements that hold data: variables, lists, dictionaries
Continue reading — free sign-up
You're reading the free preview. Sign up free to read this section in full, plus every chapter (including 4+) and all questions.

