Functions in python are defined using the 'def' keyword followed by function name and arguments to the function and a colon to start a new block.
def functionName(arguments):
return [expression] is used to return a value from the function.
Python program uses indentation to start a new block. A indentation of 4 spaces is generally used to form the block of statements.
To break from a function use return with no expression, this breaks and exits from the function.
return with no expression returns 'None' , Capture the return of function into a variable and check.
Download the code from GitHub
No comments:
Post a Comment