Docsity

IT Infrastructure Automation Python Automation Programming, Exams of Advanced Education

Toggle sidebar
bg1
IT Infrastructure Automation Python Automation Programming
What command can be used to install most packages from the Python Package Index (PyPI)?
- pip
Python 3 is already installed on which operating system? - Ubuntu 16.04
Which of these are valid commands that you can use with pip? - install
list
freeze
uninstall
Which of these are comparison operators? - !=
==
Complete the code to calculate a number's exponent value.
Code Editor: def exp(x,y): val = 1 for i in range(y): val <missing code> return val - *= x
Which of these statements defines a tuple named 't'? - t = (1, 2, 3)
Which of these is a valid hash bang that will help the program loader determine which
interpreter to use? - #!/usr/bin/env python3
Which statement will open a file so that you can write to it without overwriting the file
entirely? - message_file = open(my_file, 'a')
You've imported the csv module into your Python script. Which statement will create a
reader object for a csv file? - cust_reader = csv.reader(cust_file)
pf2

Partial preview of the text

Download IT Infrastructure Automation Python Automation Programming and more Exams Advanced Education in PDF only on Docsity!

IT Infrastructure Automation Python Automation Programming What command can be used to install most packages from the Python Package Index (PyPI)?

  • pip Python 3 is already installed on which operating system? - Ubuntu 16. Which of these are valid commands that you can use with pip? - install list freeze uninstall Which of these are comparison operators? - != == Complete the code to calculate a number's exponent value. Code Editor: def exp(x,y): val = 1 for i in range(y): val return val - *= x Which of these statements defines a tuple named 't'? - t = (1, 2, 3) Which of these is a valid hash bang that will help the program loader determine which interpreter to use? - #!/usr/bin/env python Which statement will open a file so that you can write to it without overwriting the file entirely? - message_file = open(my_file, 'a') You've imported the csv module into your Python script. Which statement will create a reader object for a csv file? - cust_reader = csv.reader(cust_file)

Complete the code to successfully load a json structured data file for processing using the json module in Python. Code Editor: customer_open = open(my_file) customer_data = print(customer_data) input("\npress Enter to continue...\n") - json.load(customer_open) Which module can you use to parse an XML file using Python? - xml.etree.ElementTree Which statement downloads a webpage using the requests module? - requests.get('https://www.gutenberg.org/catalog/') You've created a new cron job named job. Which statement will set the frequency of the job to once per minute? - job.minute.every(1) Which statement successfully creates a zipfile using the zipfile module in Python? - backup_zip_file = zipfile.ZipFile(zip_filename, 'w')