Functions are reuseable and callable code structures. Functions have their own namespace also known as local.
A function definition has function_name with parameters. Function names generally follow snake_case or camelCase conventions. def is the keyword used to define function.
return is used to return the function outcome in memory which can be referred by a calling variable. The program control flows back to the function call when a return statement is executed. If function has no return statement or it is never executed the return value is None.
lambda is a keyword in Python. Like def it is also used for function definition.
lambda functions are always one-liner function shortcut. They can also be anonymus at times.
lambda function syntax
>>> add = lambda a, b: a+b >>> add(2, 3) 5 >>> even = lambda x: x%2==0 >>> even(22) True >>> even(23) False