logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Gary BartonAccounting
(5/5)

532 Answers

Hire Me
expert
Miguel OrtizzSocial sciences
(5/5)

856 Answers

Hire Me
expert
Logan AndressonPsychology
(5/5)

720 Answers

Hire Me
expert
Ata WhbaLaw
(5/5)

557 Answers

Hire Me
Python Programming

Create a script called partI.py. In this script, define the readFile(): will take a string filename as a parameter, and it will return a list.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

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

 

  1. 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

 

  1. 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.

  2. 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

  3. (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

  4. 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

  5. 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

  6. findTheLargest():will take a list of values, mylist containing numeric values, and it will return the largest value from the argument s.

  7. findTheSmallest(): will take a list of values, mylist containing numeric values and it will return the smallest value from the argument

  8. 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

  9. 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 ]

 

  1. where the option can be one of the three following options:

    1. -a: will read from arguments

    2. - i: will interact from user

    3. - r: will generate a file with random numbers

  2. If the option is -a then you need to provide arguments (two file names)

  3. If the option is -i then you don't need to provide any arguments

  4. 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

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

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

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme