Given a list of integers, we want to find their average. Specifically, you are required to write a function named aver
that accepts any arbitrary number of integers as arguments and returns the average of those integers as a float.
You can start with this template code and ensure your code can run correctly within this template:
def aver(): # fill in your declaration of parameters
# your code here
# Note that the following code is for local testing purposes only. You should leave this part of code unchanged and not submit it to the OJ system.
T = int(input())
for t in range(T):
nums = [int(n) for n in input().split()]
mean = aver(*nums)
print(f'{mean}')
Please note that you only have to submit the definition of the aver
function to the OJ system. The rest of the code is for your local testing purposes only.
Input Specification
The first line of the input gives the number of test cases, , and then test cases follow.
For each test case, there will be a single line containing a list of integers separated by space.
Constraints
Output Specification
For each test case, output a single line containing a floating point number that represents the average of the given integers.
Sample Input
2
1 2 3
7 3 5 7
Sample Output
2.0
5.5
Hint
function
variable-length-arguments
Comments