Working With: Chapter - 3
Working With: Chapter - 3
WORKING
WITH
FUNCTIONS
Functions :
Large programs are avoided because it is difficult
to manage a single list of instructions.
Thus, a large program is broken into smaller units
known as functions.
A function is a subprogram that acts on data and
returns values.
Advantages of using functions :
- It makes program handling easier as a small part of
program is dealt at a time.
- It reduces size of program.
- It makes program more readable and understandable.
- Same piece of code can be invoked many times.
Functions in :
Mathematics :
f(x) = 2x where f, x is its argument
i.e., value given to it.
and 2x is functionality.
For different values of argument x, function f(x) will
return different results.
Python :
8) If the called function does not return any value i.e., the
return statement has no variable, value, expression, then
the control jumps back to the line following the function
call statement.
Arguments
and
Parameters
Parameters
→
→
Arguments
So we can say that :
Values being passed through function call are called
as Arguments.
(or Actual Parameters or actual argument).
SUBSCRIBE
Share it with your friends so that they too can know about this.