DEF function in Python

  • The Python Def function is the User-Defined one.
  • Function blocks start with the keyword def then followed by the function name and parentheses ( ( ) ).
  • Any input parameters must place inside the parentheses. Now you can define parameters inside the parentheses.
  • The initial statement of a function is optional statement – the documentation string of the function (docstring).
  • Within the code block each and every function begins with (:) colon and is indented.
  • The statement return [expression] exits the function, alternatively passing back the expression to caller. The return statement with no arguments is the similar as return none.
def function in python

Syntax:

def functionname( parameters ):
   "function_docstring"
   function_suite
   return [expression]

Categorized in:

Python

Tagged in:

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Share Article:

Leave a Reply

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock