Functions.pptx Basically Function is a self contained block of code which does a specific task. It is reusable code It is modularity code The code which is already available and derived from a package or module is called “Built-in Function”.
Basically Function is a self contained block of code which does a specific task.
It is reusable code
It is modularity code
The code which is already available and derived from a package or module is called “Built-in Function”.
Hierarchy of management that covers different levels of managementmkooblal
More Related Content
Similar to Functions.pptx Basically Function is a self contained block of code which does a specific task. It is reusable code It is modularity code The code which is already available and derived from a package or module is called “Built-in Function”.
Similar to Functions.pptx Basically Function is a self contained block of code which does a specific task. It is reusable code It is modularity code The code which is already available and derived from a package or module is called “Built-in Function”. (20)
9953330565 Low Rate Call Girls In Rohini Delhi NCR
Functions.pptx Basically Function is a self contained block of code which does a specific task. It is reusable code It is modularity code The code which is already available and derived from a package or module is called “Built-in Function”.
2. CONTENT
INTRO TO FUNCTIONS
TYPES OF FUNCTIONS
TYPES OF FUNCTIONS
ARGUMENTS
RECURSIVE FUNCTIONS
1
2
3
5
NTH@COPYRIGHT WWW.NATIVETECHHUB.COM
SCOPE OF FUNCTION
VARIABLES
4
3. Built-In Functions
› Basically Function is a self
contained block of code
which does a specific task.
› It is reusable code
› It is modularity code
› The code which is already
available and derived from
a package or module is
called “Built-in Function”.
Copyright@NTH NTH@PipeLine TO LifeLine
› Ex.
› height=[1.73, 1.68, 1.71,
1.89]
› max(height)
› help(max)
4. User Defined Function
› Function definition has
“def” keyword followed
function name, function
parameters /arguments
within the parenthesis
followed by colon and
indented blocks of code
in function body.
Copyright@NTH NTH@PipeLine TO LifeLine
› Function are invoked by
a function call by
passing appropriate
parameters
6. User Defined Function
› Rules: To pass
arguments to the
function in Python:
› Arguments are passed by
reference
› Changes made to the formal
parameters would reflect on
to the actual parameters
based on data type called
mutable or immutable
Copyright@NTH NTH@PipeLine TO LifeLine
› In Python
› Immutable Data Types:
› Number, Strings,
Tuples
› Mutable Data Types:
› List, Sets, Dictionary
7. User Defined Function
› #Immutable data type: number as argument to the function
Copyright@NTH NTH@PipeLine TO LifeLine
9. › Required Arguments
› Keyword Arguments
› Default Arguments
› Variable Length Arguments
Various Type of Formal Arguments
Copyright@NTH NTH@PipeLine TO LifeLine
10. › Required Arguments:
› Arguments follow positional
order
› No. of arguments are same
as function definition
› Order of the arguments as
same as in the function
definition
Copyright@NTH NTH@PipeLine TO LifeLine
11. › Keyword Arguments:
› When used in functional
call, calling function
identifies the argument by
parameter name
› Allows to change the
positional order of
arguments
› Python Interpreter uses the
keyword provided to
match the values with
parameters
Copyright@NTH NTH@PipeLine TO LifeLine
12. › Default Arguments:
Consider a default value if the
value is not passed for a
parameter in the function call
Copyright@NTH NTH@PipeLine TO LifeLine
13. › Variable Length Arguments:
Used to execute functions
with more arguments than
specified during function
definition
Variable arguments will
not have a name while
defining a function when
compared to required and
default arguments
Copyright@NTH NTH@PipeLine TO LifeLine
› Syntax:
› An asterisk “ * “ is located before
variable name to hold all non-
keyword variable arguments.
› * var-args-tuple is empty if no
additional arguments are specified
during functional call
15. Scope of Variables
› Determines accessibility of a
variable at various portions of
the program.
› Types of Variables
› Local
› Variables defined
inside the function
have local scope
› Can be accessed only
inside the function in
which it is defined.
Copyright@NTH NTH@PipeLine TO LifeLine
› Global:
› Variables defined outside
the function have global
scope
› Variables can be accessed
throughout the program by
all other functions
17. Scope of Variables
Copyright@NTH NTH@PipeLine TO LifeLine
› Usage of global keyboard:
› Used to access the variable outside the function
18. Recursion
› A function called itself is called Recursion
Copyright@NTH NTH@PipeLine TO LifeLine
19. Lambda Function
› We use lambda functions when we require a nameless function
for a short period of time.
› In Python, we generally use it as an argument to a higher-order
function (a function that takes in other functions as arguments).
› Lambda functions are used along with built-in functions like
filter() , map() etc..
› addresult=lambda a,b:a+b
› print(addresult(10,20))
Copyright@NTH NTH@PipeLine TO LifeLine
20. Any questions?
You can find me at:
info@nativetechhub.com
#9908133590
Copyright@NTH NTH@PipeLine TO LifeLine