CSC242 Daily Exercise 4 Python recursive search()

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.

Leave a Reply

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

  • File Format: Python .py
  • Version: 3.5.2 and 2.7 Both