Don't let the Lockdown slow you Down - Enroll Now and Get 3 Course at 24,999/- Only. Explore Now!

General

Python Functions

Python Functions

Python Functions

A single statement or set of statements for doing the specific operation and returning output
It should come with common or repetitive tasks which make a function. In place of coding the same snippet multiple times for different parameters, we can group it or summarize as function.

Types Of Functions:

  •  built-in functions (print, range)
  • user defined functions (Our set of code)

Example :

Python Function Example

Pass by Reference or pass by value?

variable name —>  reference.

Whenever we send/pass a variable/argument to a function, one new reference to the object is being created.

Parameter pass in Python—> reference pass in language Java.

Pass by Reference or Pass by Value

Default argument/Parameter pass:

Default Argument

Assumes a default value/Argument if no value (NULL) available for function call for that particular values/argument.

Particular Argument

Variable length arguments:

Contains normal(argument/variable) and keyword (fixed words) variable/dynamic number of arguments/variables

Variable Length Arguments

Anonymous functions:

Lambda function / one line function for efficient and short functions

Anonymous Functions

Click Here-> Get Python Training from Expert

Besant Technologies WhatsApp