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 implemenations 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
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started