globalrev wrote:
if i want a function that can take any amount of arguments how do i
do?

Put an asterisk before the argument name.


lets say i want a function average that accepts any number of integers
and returns the average.

def avg(*args):
  return sum(args) / len(args)

There are some dangers (at least two glaring ones) with this code, though, which I leave as an exercise for the reader.

:)

Paul
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to