Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

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

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions

Question

\f

Answered: 1 week ago

Question

8. Describe the steps in the development planning process.

Answered: 1 week ago