0

What would be the closest equivalent to the map function in python? For example:

def my_map(func, arg_list):
    return [func(arg) for arg in arg_list]

def my_squared_func(arg):
    return arg * arg

my_map(func=squared, arg_list=[1,2,3,4,5])
[1, 4, 9, 16, 25]

Is this approximately what map() returns, if not, what does the function look like?

FI-Info
  • 635
  • 7
  • 16

0 Answers0