-2

are these two terms argument and parameter same or they have different meanings in python functions? Please help me with some examples also. can we call actual parameter or actual argument? can we call formal parameter or formal argument?

  • 1
    From the official docs glossary: [argument](https://docs.python.org/3/glossary.html#term-argument) vs [parameter](https://docs.python.org/3/glossary.html#term-parameter) – buran May 30 '23 at 06:44

2 Answers2

2

Parameters are the variables that accept within the function definition. Arguments are the values that pass into the function when it is called.

For example,

def func(param_1, param_2):
    pass

func(arg_1, arg_2)

In above function, param_1 and param_2 are considered as parameters. The arg_1 and arg_2 are the arguments.

Usually when we call a function with passing arguments it is called as Argument parsing but sometimes it is also referred as parameter passing.

Sahan
  • 176
  • 5
0

An argument is a value passed to the function during the function call which is received in corresponding parameter defined in function header. For example:- #Program to find the sum of first n natural numbers

#function header
def sumSquares(n): #n is the parameter
    sum = 0
    for i in range(1,n+1):
      sum = sum + i
      print("The sum of first",n,"natural numbers    is: ",sum)
num = int(input("Enter the value for n: "))
sumSquares(num) #function call, here num is argument