Question: Write a python method named double that accepts self as a first special argument and a single argument: input (type list of string). This method

Write a python method named double that accepts self as a first special argument and a single argument: input (type list of string). This method should return a list containing twice as many item as in the original list:

the first half contains the same items, but each item's string is repeated two times (e.g., for input ['foo', 'bar'] , the first part of the new list should be ['foofoo', 'barbar'] )

the second half contains rearranged elements of the original list: all odd elements first, then all even elements. For the input ['a', 'b', 'c', 'd'] , the second half should be ['a', 'c', 'b', 'd'] .

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!