Question: Statistics are often calculated with varying amounts of input data. Write a program that takes any number of integers as input, and outputs the average
Statistics are often calculated with varying amounts of input data. Write a program that takes any number of integers as input, and outputs the average and max.
Ex: If the input is:
15 20 0 5
the output is:
10 20
my code is
list = input(" ") list = list.split(" ") count = 0 total = 0 max = -999999 for i in list: total += int(i) count += 1 if(int(i) > max): max = int(i) avg = total // count print(avg, max)
the output I get is: 8, 20 the code above isn't dividing by the 4 numbers in the list. It's only dividing by 3 numbers since one number is a zero. Help!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
