mean
given a list of integers,write a program to print the mean
mean - the average value of all the numbers.
input
the input will be a single line of containing space-separated integers.
output
the first line of output should contain the mean, round off the value to 2 decimal places.
mean should always be a float value.
mean should be a float value when there are even number of elements, otherwise should be an integer value.
see sample input/output for the output format
explanation
for example, if the given list of integers are
2 4 5 6 7 8 2 4 5 2 3 8
the average of all the numbers is 4.67.
after sorting the array,
2 2 2 3 4 4 5 6 7 8 8
def prod_num(*args):
j = 0
i = 0
for arg in args:
j = j + arg
i = i + 1
return j / i
Comments
Leave a comment