TypeError in python which says that dict object is not callable
TypeError in python which says that dict object is not callable I'm new to Python. I am getting the error TypeError:dict object is not callable . I haven't used dictionary anywhere in my code. TypeError:dict object is not callable def new_map(*arg1, **func): result = for x in arg1: result.append(func(x)) return result I tried calling this function as follows: new_map([-10], func=abs) new_map([-10], func=abs) But when I run it, I am getting the above error. 5 Answers 5 Seems like you are using arbitrary arguments when they are not required. You can simply define your function with arguments arg1 and func : arg1 func def new_map(arg1, func): result = for x in arg1: result.append(func(x)) return result res = new_map([-10], abs) print(res) [10] For detailed guidance on how to use * or ** operators with function arguments see the following posts: * ** ...
