Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a recursive function search () that takes as a parameter the name of a file and the pathname of a folder and searches for

Write a recursive function search() that takes as a parameter 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 anywhere in the folder or any of its subfolders. Capitalization of the file name should not matter when finding the file. The following illustrates several searches using the test folders and directories that are provided in the zip file with the assignment template: MUST USE RECURSION AND NO LOOPS

This is the output and in python please.

image text in transcribed

Python 3.6.4 Shell File Edit She Debug Options Window Help >>> 3 -search' gertrude.jpg', 'testdirs') 'testdirsW folder 1W Folder 1W FOLDER2W gertrude. jpg' >>> 3 -search PROG. PY', "testdirs') testdirs\\folder1Folder11 PROG. PY >> search('File.txt', 'testdirs') 'testdirsfileA.txt' >>> 3 -search' amber.txt', 'testdirs') >>> type (s) >> 3 search'testfile2.py,testpath') 'testpath\directorydirectoryB21testfile2.py' >>> 3 -search' gertrude.jpg', 'testpath') >>> type (s) Ln: 25 Col: 4

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

3. What strategies might you use?

Answered: 1 week ago

Question

3. Is there opportunity to improve current circumstances? How so?

Answered: 1 week ago