DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1
9. Which module provides access to the file system
and directory structure?
1. filesystem
2. open
3. system
4. os
10. Which module is a testing framework for Cisco
infrastructure?
1. pyATS
2. pyang
3. devnetats
4. ncclient

FOUNDATION TOPICS


PYTHON FUNCTIONS


In Python, a function is a named block of code that can
take a wide variety of input parameters (or none at all)
and return some form of output back to the code that
called the function to begin with. It represents a key
concept in programming sometimes referred to as DRY,
which stands for Don’t Repeat Yourself. The idea behind
DRY is that if you perform some particular operations in
your code multiple times, you can simply create a
function to reuse that block of code anywhere you need it
instead of duplicating effort by typing it each time.


Python offers two types of functions: built-in functions
that are part of the standard library and functions you
create yourself. The standard library includes a huge
number of functions you can use in your program, like
print(), many of which you have already been
introduced to in Chapter 3. Building your own functions
is how you construct capabilities that are not already
present within the Python language.

Free download pdf