Answer to Question #316535 in Python for mean

Question #316535

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



1
Expert's answer
2022-03-24T18:13:39-0400
def prod_num(*args):
    j = 0
    i = 0
    for arg in args:
        j = j + arg
        i = i + 1
    return j / i

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS