Functions in Python_2
Functions in Python_2
(More on Functions)
• Syntax of Function
• Exercises
Types of Arguments
• Arguments
• Arguments are the data you pass, when a method is called.
• Argument is the actual value that gets passed to function.
• Parameters
• A parameter is a variable in a method definition.
• Keyword arguments
• Default arguments
• Variable-length arguments
Positional Arguments
• Positional arguments passing is a method of passing values to
parameters in a function using the convention of “position” of the
parameters to the called function.
• The second parameter gets the second value sent and so on.
Positional Arguments: Example
def NewFunction( name, age, quali):
print(“The age of”, name, ‘is’, age)
print(“The qualification of”, name, ‘is’, quali)
Test( 10 );
Test(10, Agra='Taj Mahal', Delhi='Red Fort’);
• Keyword arguments
• Default arguments
• Variable-length arguments