This is a comprehensive quiz to test and evaluate your knowledge on Python. It is composed of two parts and it must be done individually. The purpose of this script is to process files, store them into a data structure (i.e., a list), define functions that will process items, and then report analysis and calculations into a file.
PART I (10 POINTS)
Create a script called partI.py. In this script, define the following functions
printOptions(): a function that will display the following message:
>python3 partI.py [-option] [arguments] [-a]: read from argument
[argument l]: name of file desired to read [argument 2]: name of file desired to write [argument 3]: target desired to fin on argument 1
[-i]: interact with user (no arguments needed)
[ -r ] : generate random file
[argumentl] corresponds of filename
[argument2] corresponds to how many numbers to generate [argument3] corresponds to start number
[argument4] corresponds to end number
readFile(): will take a string filename as a parameter, and it will return a Each element of the list represent a line from the file filename.
writeToFile(). Will take a string filename as a parameter and a list mylist as a parameter. The purpose of this function is to write in the file "filename ", the contents of
(optional) validateFile(): Will take a string filename as a parameter. The purpose of this file is to check if the filename exists or not . In case the file exists, the function will return True, otherwise will return False
calculateSum(): will take a list of values, mylist containing numeric values. The purpose of this function is to calculate the sum of all the items in the
calculateAverage(): will take a list of values, mylist containing numeric values. The purpose of this function is to calculate the average of all the items in the
findTheLargest():will take a list of values, mylist containing numeric values, and it will return the largest value from the argument s.
findTheSmallest(): will take a list of values, mylist containing numeric values and it will return the smallest value from the argument
count Total Ti me s ( ) : The function will take a target as an argument and a list as argument. Your function will count the total number of times the target appears in the list
f i nd St d De v () : This function will take a list a of numeric values as a parameter. The function shall return the standard deviation Sx of the values in the list Remember that the standard deviation can be calculated as follow:
where:
N = the total numbers in the data file
x = the mean of x; (also known as the average)
x; = Each of the values in the array
11.genera teRandom () : The function will take 4 arguments:
filename: the name of the file where a random number will be appended
total: the total number of random numbers to generate randomly
st art: the starting random number to be generated
end: the ending random number to be generated
PART II I
You will need to use part I . pytodevelop Part II. Create a Python script called part II .py.This script will be in charge of interact with the user through two different modes depending on the command provided as the argument when you execute the script as fo llows :
> python3 part II .py [ - o p t i o n ] [ ar gume nt s ]
where the option can be one of the three following options:
-a: will read from arguments
- i: will interact from user
- r: will generate a file with random numbers
If the option is -a then you need to provide arguments (two file names)
If the option is -i then you don't need to provide any arguments
If the user did not provide any option, your script shall print the following error message
Pl e a s e provide a valid opt i on : python3 partII.py [ - op t i on ] [ ar gume nt s ]
And the function printOptions ()from Part I shall be called displaying the possible options for the program
You should run your program with the command shown in previous section. Where:
-a: means you will process the information from the command line
[argumentl] is the name of the file your program will read
[argument2] is the name of the file your program will write the results
[argunmet3] is the target interested to find
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme