I have two methods max(x, y) and min(x, y) which return maximum and minimum values of the arguments passed to them respectively.
I need to make a call to each one of them using lambda function something like...
funWithNum = [lambda x: funWithNum[0], max , lambda y: funWithNum[1], min]
print funWithNum[0](1, 2)
print funWithNum[1](1, 2)
When I use print funWithNum[0](1, 2), I should get max number and when I use print funWithNum[1](1, 2), I should get min number. How do I achieve this?
lambda?maxandminin the list, nothing else?lambdafunction returns itself. The second one returnsmax. I recommend doing some more research on whatlambdais.max&minare methods, but in your code they look more like ordinary functions. Are they functions that you've written, or are they Python's built-inmax&minfunctions?