subject

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

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 06:30
Me and category do i put them in because this is science
Answers: 1
question
Computers and Technology, 24.06.2019 13:20
3. ranga ramasesh is the operations manager for a firm that is trying to decide which one of four countries it should research for possible outsourcing providers. the first step is to select a country based on cultural risk factors, which are critical to eventual business success with the provider. ranga has reviewed outsourcing provider directories and found that the four countries in the table that follows have an ample number of providers from which they can choose. to aid in the country selection step, he has enlisted the aid of a cultural expert, john wang, who has provided ratings of the various criteria in the table. the resulting ratings are on a 1 to 10 scale, where 1 is a low risk and 10 is a high risk. john has also determined six criteria weightins: trust, with a weight of 0.3; quality, with 0.2; religious, with 0.1; individualism, with 0.2; time, with 0.1; and uncertainity, with 0.1. using the factor-rating method, which country should ranga select? why? (2 points)
Answers: 3
question
Computers and Technology, 25.06.2019 01:30
Once a vulnerability has been identified by nessus, where would you check for more information regarding the identified vulnerability, exploits, and any risk mitigation solution?
Answers: 1
question
Computers and Technology, 25.06.2019 06:30
How can u permanently delete a picture from your camera ?
Answers: 1
You know the right answer?
In python please!! Write a program that reads an unknown number of integers (don't tell the progra...
Questions
question
Mathematics, 08.02.2021 07:20
question
Mathematics, 08.02.2021 07:20
question
Arts, 08.02.2021 07:20
question
Mathematics, 08.02.2021 07:20
Questions on the website: 13722361