Function
Function
Function
Body of Function
Eg:
def SUM( x,y):
print (“Welcome to Python”)
Function Name: It is a type of identifier that identifies a function from other.
Function name is used to invoke/ call a function.
Parameter/ Argument: Parameters are generally used for massage passing or
data passing i.e. if there is a need of passing values form one function to other
then parameters are used.
Parameters can be of two types:
Formal parameters: Parameters that are declared during function
definition or prototype, such parameters are known as formal parameters.
Actual parameters: These parameters are the actual values that are
passed to formal parameters during a function call or invocation.
Function Signature: It is a part of function prototype that defines the number
and type of parameter or argument.
Indentation: The blank space in the beginning of a statement within a block.
All statements within same block have same indentation.
Default Arguments:
A parameter having default value in the function header is known as a default
parameter.
Note: In a function, any parameter cannot have a default value unless all
parameters appearing on its right have their default values.
E.g.
x=5 #global variable
def Func(a):
b=a+1 # b is local variable
return b
y= input(“Enter a number”)
z=y + func(x)
print(z)