+ 2

What is difference between argument and parameters.

16th Mar 2018, 10:20 AM
Maninder $ingh
Maninder $ingh - avatar
3 Réponses
+ 3
A stackoverflow user wrote: << Generally when people say parameter/argument they mean the same thing, but the main difference between them is that the parameter is what is declared in the function, while an argument is what is passed through when calling the function. def add(a, b): return a+b add(5, 4) Here, the parameters are a and b, and the arguments being passed through are 5 and 4. Since Python is a dynamically typed language, we do not need to declare the types of the parameters when declaring a function (unlike in other languages such as C). Thus, we can not control what exact type is passed through as an argument to the function. For example, in the above function, we could do add("hello", "hi"). This is where functions such as isinstance() are helpful because they can determine the type of an object. For example, if you do isinstance("hello", int), it will return False since "hello" is a string. >> https://stackoverflow.com/questions/47169033/parameter-vs-argument-python You could get further (and more generic) informations in this another stackoverflow thread: https://stackoverflow.com/questions/156767/whats-the-difference-between-an-argument-and-a-parameter And anyway, you could get a lot of answer just by googling "argument vs parameter": https://www.google.com/search?q=argument+vs+parameter
16th Mar 2018, 8:08 PM
visph
visph - avatar
+ 8
In general , The parameters are data which a function wants to run.(data when function is created) Arguments are the data provided to these functions.(data when dunction is called).
16th Mar 2018, 10:32 AM
cHiRaG GhOsH
cHiRaG GhOsH - avatar
0
cHiRaG GhOsH what which variable under the scope of function is a argument.
16th Mar 2018, 10:55 AM
Maninder $ingh
Maninder $ingh - avatar