def square(x):
int(x)
return 2(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)
i'm trying to pass a number to a function and have it print the result, i have a function for the equation def square()
, and a function that receives the numbers and the function
I keep on getting this error:
"TypeError: 'int' object is not callable"
I'm new to programming and was watching corey shaffer in YouTube and he wrote a program similar to this one. I started to play around with it, and now I'm stuck.
I would like the print statement to print out arg_list(i)
and have I go through def square(x)
and have that answer stored in result