0
def print_double(x):
is x a placeholder for any number or is x a set argument in Python
3 Answers
+ 5
As you wrote:
def print_double(x):
... 'x' is argument.
But if you write:
def func1(*x):
... then 'x' is a tupple of arguments passed to the function.
And by writing:
def func2(**x):
... you'll get a dict of nammed arguments.
In a similar way, you can do the inverse, to call a function requiring many arguments with list or dict, by prefixing them of one or a pair of asterisk ( star * )...
+ 1
it is argument like other languages.
+ 1
x is an argument..
def print_double(x):
x=x+x
print(x)
a=5
print_double(a)