[Tutor] parameters vs arguments
BINTO
binto at triplegate.net.id
Fri Nov 6 04:06:04 CET 2009
I understand now…
Thanks
Binto
From: ALAN GAULD [mailto:alan.gauld at btinternet.com]
Sent: Friday, November 06, 2009 7:41 AM
To: BINTO
Subject: Re: [Tutor] parameters vs arguments
> Parameter is what used to give/call value in function.
> Argument is what used to give/call value in command line interface.
>
> Am I correct??...
No.
parameters are what you use when you create the function definition.
For example
def f(x):
return 2*x
x is the parameter.
Now when I call f() I must pass in a value (or variable with a value).
The thing I pass in when I call f() is the argument.
f(2)
2 becomes the argument for this particular call to f.
The parameter x of f takes on the value 2 during this particular invocation.
z = 7
f(z)
z is now the argument of f for this invocation.
The parameter x takes on the value 7, which is the value of the argument, z
x is always the parameter of f() but the argument can change
each time you call f()
HTH,
Alan G.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091106/5c142ae0/attachment.htm>
More information about the Tutor
mailing list