What is differences between parameter and argument in python? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

What is differences between parameter and argument in python?

18th Feb 2019, 9:14 AM
Raj Charan
4 Respostas
+ 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))
18th Feb 2019, 9:45 AM
LĆ©a
LĆ©a - avatar
+ 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
18th Feb 2019, 9:45 AM
Ipang
+ 2
Thank you LĆ©a and Ipang
18th Feb 2019, 9:49 AM
Raj Charan
0
Thanks
23rd Oct 2019, 10:29 AM
Gopinath Gopinath
Gopinath Gopinath - avatar