0% found this document useful (0 votes)
44 views

Assessment 2 Final v0.1

The document outlines an assessment with 6 questions to test Python scripting skills for automation, including reading and parsing text and CSV files, defining arithmetic functions and unit tests, completing code to generate employee IDs and look them up, and fixing bugs in a question generator program to prevent duplicate entries.

Uploaded by

Savant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Assessment 2 Final v0.1

The document outlines an assessment with 6 questions to test Python scripting skills for automation, including reading and parsing text and CSV files, defining arithmetic functions and unit tests, completing code to generate employee IDs and look them up, and fixing bugs in a question generator program to prevent duplicate entries.

Uploaded by

Savant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Objective of this Assessment: Python scripting skills needed for automation.

Assessment 2 questions:

1. Read the attached text file and print the total number of lines. (5 Points)

test.txt
2. Read the attached csv file, (15 Points)
a. Print Inspection ID of Restaurants with High Risk value “Risk 1(High)”.
b. Print License # and Inspection Date of Restaurants having VENTILATION violations.

fiveguys.csv

https://docs.python.org/3/library/csv.html

3. Create 4 functions to perform arithmetic operations. Write all outputs to a single text file. Use
below table for function names and parameter values. (15 Points)

Function Parameter 1 value Parameter value 2 Expected result


name
add 1000 200.50 1200.50
divide 500 25 20
multiply 30 10 300
subtract Result from multiply Result from divide 280
function function

4. Write at least 10 unit tests to validate the functions from Question #3 (15 Points)
https://docs.python.org/3/library/unittest.html

In computer programming, unit testing is a software testing method by which individual units


(functions) of source code is tested.
5. We are building an Employee class that generates an employee id upon initialization. Please
complete the code for methods. (25 Points)
a. generate_employee_id_and_add_to_employees (generate employee id and append
employee information to employees list)
b. what_is_my_employee_id (Lookup the employees list and returns the employee id)

Use attached code.txt to copy the code over to your IDE.

code.txt
6. Here is our Question Generator program. (25 Points)
a. Add logic to method “add_to_bucket” to prevent duplication. Use question id as a
unique identifier.
b. The hint from question 2 got added to question 1. Please fix the bug.

Script output:
{'question_id': 1, 'question_description': 'is python easy to learn?', 'question_hints': ['coding standards', 'pythonic
way']}
{'question_id': 2, 'question_description': 'what is pep8 standards?', 'question_hints': ['coding standards', 'pythonic
way']}

code.txt

You might also like