Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

6.

24 LAB Varied amount of input data


Instructor note:
Note: this section of your textbook contains activities that you will complete for points. To
ensure your work is scored, please access this page from the assignment link provided in
Blackboard. If you did not access this page via Blackboard, please do so now.
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

data = input().split()

total = 0

largest = None

for num in data:

num = int(num)

total += num

if largest is None or num > largest:

largest = num

print(total // len(data), largest)

You might also like