Getting a TypeError when trying to pass two arguments to my function but I defined it with two parameters
I am working on a small assignment where I need to calculate the average of a list of numbers using a function. My function takes two arguments but every time I call it I get a TypeError and I cannot figure out what I am doing wrong because the number of arguments looks correct to me.
Here is my code:
python
def calculate_average(total, count):
return total / count
scores = [85, 90, 78, 92, 88]
result = calculate_average(sum(scores), len(scores), scores)
print(result)
And here is the exact error I am getting:
TypeError: calculate_average() takes 2 positional arguments but 3 were given
I read the error message and I thought my function only takes two arguments so I am confused about where the third one is coming from. I have looked at this for a while and I cannot spot it. Can someone help me understand what I am missing here?