Specifying arguments when you call a function

The basic way of specifying arguments is to pass them when you call the function.

To pass an argument, type it between the parentheses of a function when you call the function, like this:

The following example creates a function that prints the value of its argument, gives a name to a tuple, and passes the name to the function:

... print "you passed me the argument", repr(x)

The following example passes the same function a string literal without defining a name:

you passed me the argument 'hello'

Was this article helpful?

0 0

Post a comment