0

def print_double(x):

is x a placeholder for any number or is x a set argument in Python

26th Feb 2017, 3:12 PM
Jamal Bee
Jamal Bee - avatar
3 odpowiedzi
+ 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 * )...
26th Feb 2017, 6:41 PM
visph
visph - avatar
+ 1
it is argument like other languages.
26th Feb 2017, 3:31 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
+ 1
x is an argument.. def print_double(x): x=x+x print(x) a=5 print_double(a)
26th Feb 2017, 4:25 PM
LordHill
LordHill - avatar