Question: Write a recursive function that expects a pathname as an aWrite a recursive function that expects a pathname as an argument. The pathname can be
Write a recursive function that expects a pathname as an aWrite a recursive function that expects a pathname as an argument. The pathname can be either the name of a file or the name of a directory. If the pathname refers to a file, its name is displayed, followed by its contents. Otherwise, if the pathname refers to a directory, the function is applied to each name in the directory. Test this function in a new program in the file viewfiles.pyrgument The pathname can be either the name of a file or the name of a directory. If the pathname refers to a file, its name is displayed, followed by its contents. Otherwise, if the pathname refers to a directory, the function is applied to each Write a recursive function that expects a pathname as an argument. The pathname can be either the name of a file or the name of a directory. If the pathname refers to a file, its name is displayed, followed by its contents. Otherwise, if the pathname refers to a directory, the function is applied to each nameWrite a recursive function that expects a pathname as an argument. The pathname can be either the name of a file or the name of a directory. If the pathname refers to a file, its name is displayed, followed by its contents. Otherwise, if the pathname refers to a directory, the function is applied to each name in the directory. Test this function in a new program in the file viewfiles.py in the directory. Test this function in a new program in the file viewfiles.pyname in the directory. Test this function in a new program in the file viewfiles.py
Displays a menu of commands.
Accepts an input command from the user.
Calls a function to perform the command.
Repeats steps a through c until the user selects the "Quit" command.
The program should define three other functions, named printMenu, acceptCommand, and performCommand, to carry out steps a b and c respectively. The function to display the menu expects a list of menu options as an argument and displays these options prefixed with numbers. The function to accept an input command expects the length of the menu list as an argument. The function repeatedly prompts the user for a number in the range of options and takes inputs until the user enters a number within the range. The function either displays an error message for an invalid input or returns a valid input. The function to perform a command takes a command number and the menu as arguments and displays the selected command in the menu. Test your program with the menu Open "Save", "Compile", "Run", "Quit" and at least one other menu. Note that all menus must include a "Quit" command as the last item in the menu. LO:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
