Question: Write a function map(function, seq) that models a limited version of the behavior of the built-in function. Input: a function function and a sequence seq.
Write a function map(function, seq) that models a limited version of the behavior of the built-in function.
Input: a function function and a sequence seq.
Output: a list comprising the output of function for each element in seq. The order of seq must be maintained. If seq is empty, return an empty list.
Note: Remember that a sequence can be a list, a string, a tuple, or a range, so this function must work for all these types.
Step by Step Solution
3.52 Rating (152 Votes )
There are 3 Steps involved in it
C re mainpy Us GDB 123456 2 def mapcustomfunc seq result fo... View full answer
Get step-by-step solutions from verified subject matter experts
