Computers and Technology
Computers and Technology, 20.10.2021 03:20, kbar7555

In python please!! Write a program that reads an unknown number of integers (don't tell the program how many integers to expect in advance) into a dynamically resizing array. Then, calculate the sum and the average values of these integers. Your basic algorithm should be as follows,

1) Create an initial array of some reasonable size
2) Read data into the array until it is full
3) Resize the array, increasing its size by some reasonable amount
4) Repeat steps 2 and 3 as needed, until all data is read (EOF is read from stdin)
5) Calculate the sum of all the integers
6) Calculate the average of all the integers
7) Display both numbers

As you are doing this, you may use the sum function, or an accumulator loop, to calculate the sum. I will warn you that using the sum function on its own will likely not work properly for you--you'll need to do some extra work before calling it. The accumulator loop is going to be easier to do.

DO NOT USE ANY OF THE FOLLOWING:

stdio. readAllInts, or any of the related readAll functions in stdio
the .append() method of the List data type
array concatenation

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 01:30, gabriieldelacruz16
What “old fashioned” features of checking accounts is p2p replacing
Answers: 3
image
Computers and Technology, 22.06.2019 22:30, juliangarcia0002
Which of the following factors would your hypothetical supervisor look at when deciding whether to test a biological material sample for dna? the amount of other evidence you have implicating a suspect in a crime the annual budget for the crime lab both of the above none of the above; you would almost always order a test
Answers: 3
image
Computers and Technology, 24.06.2019 12:30, stephanieanaya7
Why does the pc send out a broadcast arp prior
Answers: 1
image
Computers and Technology, 24.06.2019 15:00, cooljariel11
What questions about an audience should be asked during presentation preparation? check all that apply. what does the audience already know about the topic? how will multimedia tools inspire the audience? is the information interesting and engaging? how will this information affect the presentation? will the audience change the message’s purpose? what is likely to interest the audience?
Answers: 3
Do you know the correct answer?
In python please!! Write a program that reads an unknown number of integers (don't tell the progra...

Questions in other subjects:

Konu
Mathematics, 19.07.2019 07:00
Konu
Mathematics, 19.07.2019 07:00