So far we have only seen the functions which come with Python either in some file (module) or in interpreter itself (built in), but it is also possible for programmer to write their own function(s) and are called User Defined Functions . These functions can then be combined to form a module which can then be used in other programs by importing them. In the context of programming, a function is a named sequence of statements that performs a desired operation. This operation is specified in a function definition. To define a function keyword def is used. After the keyword comes an identifier i.e.name of the function, followed by parenthesized list of parameters and the colon which ends up the line. Next follows the block of statement(s) that are the part of function. A block is one or more lines of code, grouped together so that they are treated as one big sequence of statements while executing. In Python, statements in a block are written with indentation. Usuall...
Python for ktu students-by Dr Binu V P-9847390760. This Blog is written using python 2.x. Visit the new blog pythonformlktuminor.blogpost.com for python 3.x