Calling a Function:
A function can not run/execute
its own. It runs only when we call the function by using its name, while
calling the function, we should pass the necessary values(parameters) to the
function in the parenthesis.
Ex: sum(2,3) # Here sum is a
function call, we are passing values 2, 3 to the function.
When this statement sum(2,3)
executed, the python interpreter goes to the function definition.
Example:
def test(b):
print("b=",b)
Parameters:
Parameters are the inputs to
the function. If a function contains parameters, then at the time of calling,
compulsory we should provide values otherwise, we will get error.
Next: Return statement
Prev: Functions
No comments:
Post a Comment