[Tutor] variable number of inputs

Mr Gerard Kelly s4027340 at student.uq.edu.au
Thu Jan 8 03:41:10 CET 2009

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).

More information about the Tutor mailing list