1. mymap(func, lst) Given a single-argument function and a list, return a list containing the result of...
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 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.
College Mathematics for Business Economics Life Sciences and Social Sciences
ISBN: 978-0321614001
12th edition
Authors: Raymond A. Barnett, Michael R. Ziegler, Karl E. Byleen