100% found this document useful (1 vote)
5K views

6.24 LAB Varied Amount of Input Data

This document provides instructions for an activity to write a program that calculates the average and maximum of an input of varying integer amounts. The program takes in integers separated by spaces as input, converts them to integers, sums them, and divides by the length to calculate the average. It also tracks the largest integer and prints both the average and maximum as output.

Uploaded by

CHRIS D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
5K views

6.24 LAB Varied Amount of Input Data

This document provides instructions for an activity to write a program that calculates the average and maximum of an input of varying integer amounts. The program takes in integers separated by spaces as input, converts them to integers, sums them, and divides by the length to calculate the average. It also tracks the largest integer and prints both the average and maximum as output.

Uploaded by

CHRIS D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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