Question: Python pls def tail(*iterables): pass 1: Details of tail: The tail generator function (a decorator for iterables) takes one or more arguments: all will be


Python pls
def tail(*iterables): pass
1: Details of tail: The tail generator function (a decorator for iterables) takes one or more arguments: all will be iterable. When called, it returns an iterable result that produces some of the values from the iterable argument that produces the most values: it produces values from it only after all the other iterables have stop producing values. There will always be exactly one iterable argument that produces more values than any of the others (so only one can be infinite). Using this defintion, executing for i in tail('abc', 'abcdef', [1,2]): print(i) prints d f Notice in this example that 1. All arguments are str and therefore all are iterable. 2. The second argument produces more values than any of the others. 3. The second iterable is the only one that produces a 4th value (d) so that is the first value produced by tail, followed by all other values in the second iterable: e then f. Of course, we cannot generally compute the length of an iterable, and one of the iterables might be infinite: recall only one can be infinite, because one iterable must produce more values than any of the others. Hints: Store a list of iterators still producing values. You may have to do something special for the produced value d in the example above; so, you may have to debug code that first produces only e then f, omitting d. Calling the list constructor on any finite iterable produces a list with all the values in that iterable. So, calling list ( tail('abc', 'abcdef', [1,2])) produces the list ['d', 'e','f'] Do not assume anything about the iterable arguments, other than they are iterable; the testing code uses the hide function to "disguise" a simple iterable (like a str); don't even assume that any iterable is finite: so, don't try iterating all the way through an iterable to compute its length or put all its values into a list or any other data structure. Finally, You may NOT import any functions from functools to help you solve this problem. Solve it with with the standard Python tools that you know
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
