From bdd74ca15c98b57f197590918570504e24bc6575 Mon Sep 17 00:00:00 2001 From: rasbt Date: Tue, 19 Aug 2014 09:57:13 -0400 Subject: [PATCH] short lambda example --- howtos_as_py_files/lambda_function.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 howtos_as_py_files/lambda_function.py diff --git a/howtos_as_py_files/lambda_function.py b/howtos_as_py_files/lambda_function.py new file mode 100644 index 0000000..9da0c9c --- /dev/null +++ b/howtos_as_py_files/lambda_function.py @@ -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)) \ No newline at end of file