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

(andrew) #1
2. B, C. PyPI is a repository that holds thousands of
Python modules that you can import. To install it,
you can use python3 -m (module) pip install and
the name of the package you want. You can also
directly install it with the pip command.
3. B. PEP 8 is the style guide for Python syntax, and
it specifies four spaces for each block of code.
Tabs will work, and your editor may actually
convert them automatically for you, but it is a
good practice to follow the standard.
4. B. Comments are specified by the # or three
single quotes '''. The benefit of using the single
quotes is that you can write multiline text.
5. A, B. Lists and dictionaries are both mutable, or
changeable, data types. Integers and tuples must
be replaced and can’t be edited, which makes
them immutable.
6. B, D. You can create an empty dictionary object
by assigning the function dict() to a Python
object (in this example, a). You can insert
dictionary values as well by using braces, {}, and
key:value pairs that you assign to an object.
7. C. The input() function by default creates a
string data type.
8. D. The only one that is valid as is would be
print('''hello world'''). print(hello, world)
would be valid only if there were two variables
named hello and world; otherwise, it would
produce an error. Since you don’t know in this
case whether these variables exist, print('''hello
world''') is the correct answer.
9. D. All of the statements are correct regarding
how an If statement operates in Python.


  1. A, D. The range() function in Python allows you
    to set a range that is up to but not including the
    number specified. If you want to increment to 10,
    for example, you need to provide the number 11.

Free download pdf