Loading, please wait...


What are Function Arguments in Python | Python Tutorials

Nov 09, 2020 Python, 1182 Views
Function Arguments in Python | Python Tutorials

What are Function Arguments in Python | Python Tutorials

It is great to know that in the Python Programming language, one can call a function using the following :

  • Keyword-Arguments
  • Variable Length-Arguments
  • Required-Arguments
  • Default-Arguments


When a user uses the keyword arguments during a function, it identifies the arguments by the parameter.

def name( input ):
   print input
name( input = "Rajib Kr Jha")

Variable Length-Arguments

Variable Length-Arguments process a function for more arguments than specified.

def passarg( argmt, *vartuple ):
   print "Result: "
   print argmt
   for variable in vartuple:
      print variable
passarg( 25 )
passarg( 35, 55, 90 )

Required Arguments

These are the arguments that are passed in the correct order, the number of arguments should match exactly the function defined.

def thisoneprint( name ):
   print name

Default Arguments

This is an argument that selects a default value if the value is not provided in the function call.

def information( name, salary = 45000 ):
   print "Name: ", name
   print "Salary ", salary
information( salary=50000, name="Rohan" )
information( name="Rohan" )



Related Article