3

I have such lambda:

pit = lambda p, q, r: min(A[p] - A[q], A[r] - A[q])

How I can write it on "plain" python

1 Answer 1

5

You mean as a named function? Then you would just use the def and return keywords

def pit(p, q, r):
    return min(A[p] - A[q], A[r] - A[q])
Sign up to request clarification or add additional context in comments.

2 Comments

how I can transform this to js?
I don't know, I'm not familiar with javascript. If you have a follow-up question, feel free to post a new question to Stack Overflow. (Though you should note that "translate this code snippet for me" is not often well-received, unless you show that you have tried to do so yourself first).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.