Function definition in Python

Function definition in Python

Functions are important for any programming language. While there are user defined and pre defined functions in the Python, it is important that syntax and indenting are the important points to remember. Below is the syntax for function definition in Python:

def  function-name(arguments):
    statement 1
    statement 2
    .
    .
    .
    return value

The above syntax has  to be followed along with the indenting for the interpreter to run the program. The bold letter indicate the keywords. The function definition starts with def and last statement of the function is return. Any statement beyond the return statement are ignored by interpreter. return statement is not compulsory.



        

Post a Comment

0 Comments