Question: Write a program that uses linear recursion to generate a copy of an original collection in which the copy contains duplicates of every item in

Write a program that uses linear recursion to generate a copy of an original collection in which the copy contains duplicates of every item in the original collection. Include search capability to determine if an item is in a collection. Include sort capability to sort a collection.

Program specification: Using linear recursion, implement a function that takes a list as user-supplied runtime input and returns a copy of it in which every list item has been duplicated. Given an empty list the function returns the base case of an empty list. Using Python's built-in search methods determine if a target is in the list and sort a list.

Testing requirements: Import solution module into a decoupled test driver. Demonstrate the following:

Error Checking: Validate user list input; not to advance until valid data is entered.

Test Run Requirements: Provide 5 test cases including the default base case of an empty list, duplicating 2 original collections, determine if an item is in a collection, and provide a sorted display of a collection. Provide a commented out copy of the test demonstration at the bottom of the test driver source file.

Write a program that uses linear recursion to generate a copy of

Here are some other tips and requirements: 1. Create user defined functions 2. Use data passing and return statements. Here is a sample partial run: [ ] [' copper', 'copper'] ['nicke1', 'nickel', 'copper', 'copper'] nickel in the list sorted list: ['copper', 'copper', 'nickel', 'nickel']

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!