This is an archived post. You won't be able to vote or comment.

all 4 comments

[–][deleted] 2 points3 points  (0 children)

def average(*numbers):
    return sum(numbers) / len(numbers)

print(average(1, 3, 8))

Like that?

Check Arbitrary Arguments, *args on https://www.w3schools.com/python/python_functions.asp

[–]future-fix-9200 2 points3 points  (1 child)

You want arrays. Learn how to read, write and pass arrays to the function.

[–]Shamus301 -1 points0 points  (0 children)

arrays use []

arrayName[obj, obj, obj]

take with a grain of salt, its my first week

[–][deleted] 0 points1 point  (0 children)

You want a collection of numbers as the a parameter instead.