when i run the code i get a memory location as an output
<function at 0x00000200FF8A5E50>
val = (lambda colmns:(colmns.max + colmns.min)/2
print(val)
A lambda is just an anonymous function object and that's why it prints that way. In fact, as soon as you assign it to a variable... then why have a lambda in the first place? Might as well do
def foo(colmns):
return (colmns.max + colmns.min)/2
And then it wouldn't be too surprising that print(foo) is <function 0x...>.
def. But I still needed to wrap that back specifically to the question about where "<function at 0x00000200FF8A5E50>" comes from. When you see it as a def I didn't think there would be any question about why is printed as a "function".
lambda. If you try to print it directly, you will get the address of where the lambda code lives in memory.print(val(array)).valis a function object, it isn't a "memory address", when you print a function object, that is how it is represented, just like any function, trydef foo(): return 42thenprint(foo)