Python - Kann Lambda mehr als eine Rückkehr habenPython

Python-Programme
Anonymous
 Python - Kann Lambda mehr als eine Rückkehr haben

Post by Anonymous »

Ich weiß, dass Lambda keinen Rückdruck hat. Normalerweise < /p>

Code: Select all

def one_return(a):
#logic is here
c = a + 1
return c
< /code>

Kann geschrieben werden: < /p>

lambda a : a + 1
< /code>

Wie wäre es, wenn Sie diese in einer Lambda -Funktion schreiben: < /p>

def two_returns(a, b):
# logic is here
c = a + 1
d = b * 1
return c, d

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post