You're on assignment part 1/2 for this lesson.
A programming language "supports first-class functions" when functions are treated like any other variable. That means functions can be passed as arguments to other functions, can be returned by other functions, and can be assigned to variables.
Python supports first-class and higher-order functions.
def square(x):
return x * x
# Assign function to a variable
f = square
print(f(5))
# 25
def square(x):
return x * x
def my_map(func, arg_list):
result = []
for i in arg_list:
result.append(func(i))
return result
squares = my_map(square, [1, 2, 3, 4, 5])
print(squares)
# [1, 4, 9, 16, 25]