Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could you help me fix my code, please? def execute(args): Executes the application or prints an error message if executed incorrectly. The arguments to

Could you help me fix my code, please?

def execute(args):

"""

Executes the application or prints an error message if executed incorrectly.

The arguments to the application (EXCLUDING the application name) are provided to

the list args. This list should contain either 1 or 2 elements.If there is one

element, it should be the name of the data set folder or the value '--test'.If

there are two elements, the first should be the data set folder and the second

should be the name of a CSV file (for output of the results).

If the user calls this script incorrectly (with the wrong number of arguments), this

function prints:

Usage: python auditor dataset [output.csv]

This function does not do much error checking beyond counting the number of arguments.

Parameter args: The command line arguments for the application (minus the application name)

Precondition: args is a list of strings

"""

pass# Implement this function

# total arguments

n = len(argv)

#print an error if number of arguments are incorrect

if(n<2 or n>3):

print('Usage: python auditor dataset [output.csv] This function does not do much' +

' error checking beyond counting the number of arguments.')

return

#if only one argument passed

if(n == 2):

if(argv[1] == '--test'):

print("Passed value: ", argv[1])

else:

print("Folder name: ",argv[1])

else: #if two arguments Passed

print("Folder name: ",argv[1])

print("Csv file name: ",argv[2])

execute(sys.argv)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

5. What are the major challenges facing Virgin Direct?

Answered: 1 week ago