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 19:30, tfaulk2884
Singing in the rain: this first part of the film shows the early history of motion picture. how accurate do you think the portrayal of the early motion picture industry is? why? is historical accuracy important in films and theater productions? explain.
Answers: 1
image
Computers and Technology, 23.06.2019 19:50, Aprillove7939
Which feature is selected to practice and save the timing of a presentation
Answers: 1
image
Computers and Technology, 24.06.2019 00:50, sequoyaburke
Which player type acts on other players? a. killer b. achiever c. explorer d. socializer
Answers: 1
image
Computers and Technology, 24.06.2019 06:30, hannahgracew12
Some peer-to-peer networks have a server and some don't. true false
Answers: 2
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, 28.08.2019 19:00
Konu
History, 28.08.2019 19:00