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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!