def add(*args): # *args takes multiple inputs
return sum(args)
print(add(1,2,3,4,5)) # prints 15
print(add(10, 20, 30)) # prints 60
def average2(*args):
listofvalues = []
for item in args:
listofvalues.append(item)
return sum(listofvalues) / len(listofvalues)
# to pass unlimited parameters add one astors
# this method is for positional arguments
def add(*numbers):
total = 1
for number in numbers:
total += number
return total
print(add(1, 2, 3, 4, 5)) # add as many as you want
# Output >>> 16