mirror of
https://github.com/rasbt/python_reference.git
synced 2024-11-23 20:11:13 +00:00
short lambda example
This commit is contained in:
parent
d07be79be8
commit
bdd74ca15c
11
howtos_as_py_files/lambda_function.py
Normal file
11
howtos_as_py_files/lambda_function.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Sebastian Raschka 08/2014
|
||||
|
||||
# Lambda functions are just a short-hand way or writing
|
||||
# short function definitions
|
||||
|
||||
def square_root1(x):
|
||||
return x**0.5
|
||||
|
||||
square_root2 = lambda x: x**0.5
|
||||
|
||||
assert(square_root1(9) == square_root2(9))
|
Loading…
Reference in New Issue
Block a user