0
What is differences between parameter and argument in python?
4 Respuestas
+ 3
it's the same thing.
when you define the function, it's arguments.
example: def add (x, y)
when you use the function, you pass parameters.
example :print (add (3 + 4))
+ 9
def add(a, b):
return a + b
`a` and `b` here are parameters, they are part of function definition.
sum = add(20, 22)
20 and 22 here are arguments, they are the value that are passed into the function `add` to work with, when we invoke the function.
Anything that are passed in to a function is an argument, it may be number, string, or containers (e.g. list).
Hth, cmiiw
0
Thanks