Digital Academic Solutions

CSC242 Daily Exercise 4 Python recursive search()

SOLUTION AVAILABLE AT: http://libraay.com/downloads/csc242-daily-exercise-4-python-recursive-search/

Problem:

Implement a recursive function search() that takes as parameters the name of a file and the pathname of a folder and searches for the file in the folder and any subfolder contained within it, directly or indirectly. The function should return the pathname of the file, if found, or None (the type in Python, not the string ‘None’) if the file cannot be found in the folder or in any subdirectory of the folder. You are allowed to use a loop in this function, but the main work of the function should be done using recursion.

SOLUTION AVAILABLE AT: http://libraay.com/downloads/csc242-daily-exercise-4-python-recursive-search/

Leave a Reply

Your email address will not be published. Required fields are marked *



Solutions Authored by 15+ Years Experienced Industry Experts