Mr Gerard Kelly wrote:
How can you make a function accept a variable number of inputs without
any particular limit?
Like when you define a function you usually go:
def func(a,b,c,d,e)
and if you want to give a default value for e you can use e=0 for example.
But what if you want to be able to call the function and put in as many
arguments as you want. Say it's a really simple function just adding
them all together or something (I know sum does that, but I'm just
thinking of a simple example).
def func(*a) # a will be a tuple of whatever arguments are passed in the call.
--
Bob Gailer
Chapel Hill NC
919-636-4239
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor