Question: 1. mymap(func, lst) Given a single-argument function and a list, return a list containing the result of applying that function to each element of that
1. mymap(func, lst)
Given a single-argument function and a list, return a list containing the result of applying that function to each element of that list. For example, mymap(abs, [3,-1,4,-1,5,-9]) should return [3, 1, 4, 1, 5, 9].
2.myreduce(func, lst)
Given a two-argument function and a list, return the result of using the function repeatedly to combine all elements of the list into a single value. For example, myreduce(pow, [3,-1,4,1,-5]) should compute pow(pow(pow(pow(3, -1), 4), 1), -5) and return 3486784401.0.
Restrictions
There are several full or partial implementations of map and reduce in Python already; you may not use them. Do not import anything. Do not use the built-in function map. Do not use list comprehensions. Neither of your functions (nor the file itself) should print anything nor ask for any input.
Step by Step Solution
3.42 Rating (158 Votes )
There are 3 Steps involved in it
def mymapfunc lst creating new list to store result newlst looping ... View full answer
Get step-by-step solutions from verified subject matter experts
