Question: Deliverables There is one deliverable for this assignment hw6.py Make sure the script obeys all the rules in Homework Script Rules Specification The script must
Deliverables
There is one deliverable for this assignment
- hw6.py
Make sure the script obeys all the rules in Homework Script Rules
Specification
The script must have 3 functions:
- get_command_line_arguments
- print_path_dirs
- executable_file_count
get_command_line_arguments
This function must have the following header:
def get_command_line_arguments(arg_number):
This function is used to get a certain number of command line arguments, specified by the parameter arg_number and return them as a tuple. If the user does not enter the proper number of the command line arguments, the code should print a usage message and exit the script. This message must have the following format
Usage: SCRIPT_NAME ARGUMENT_1 ARGUMENT_2
If the proper number of command line arguments has been provided, the function should return their values in a tuple.
print_path_dirs
This function must have the following header:
def get_command_line_arguments:
This function should print the pathnames of directories listed in the Unix PATH variable. Each pathname should be on a separate line.
executable_file_count
This function must have the following header:
def executable_file_count(dir):
This function should count the number of files with a .py extension and return that value.
Script for this assignment
Open an a text editor and create the file hw6.py.
You can use the editor built into IDLE or a program like Sublime.
Test Code
Your hw6.py file must contain the following test code at the bottom of the file:
get_command_line_arguments(2) agr1, arg2 = get_command_line_arguments(2) print(agr1, arg2) print() print_path_dirs() print() dir = "/home/ghoffman/course_files/it117_files" py_count = executable_file_count(dir) print("Python files", py_count)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
