lambda returning tuple
A lambda function can return complex data structures as well. e.g. a tuple.
dbl = lambda n: (n, 2*n)
ret = dbl(12)
print(ret)
Output:
(12, 24)
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
A lambda function can return complex data structures as well. e.g. a tuple.
dbl = lambda n: (n, 2*n)
ret = dbl(12)
print(ret)
Output:
(12, 24)