History of Python

You can implement a lambda function without using a variable name. You can also directly pass the argument values into the lambda function right after defining it using parenthesis. This cannot be done using def functions.

(lambda x,y : x*y)(5,7)

 #>35

x = 5
def foo():
  global x
  x =10
  print("Local:", x)

foo()
print("Global:", x)
Back to:

Leave a Reply

Your email address will not be published. Required fields are marked *