1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AysviL [449]
4 years ago
9

Write a program that asks the user for several days' temperatures and computes the average temperature for that period and how m

any days were above average. First ask the user how many days he\she wants to calculate the average for. Then create an array with that number and ask for the temperature of each day. Store the temps in the array. Then find the average and the number of days above that average. Print the results to the screen.

Computers and Technology
1 answer:
elena-14-01-66 [18.8K]4 years ago
4 0

Answer:

#section 1

<em>no_of_days= int(input('How many days are we geting the average for: ')) </em>

<em>tem=[] </em>

<em>for i in range(no_of_days): </em>

<em>    a= int(input('Enter temperaure: input ' + str(i+1)+'  :')) </em>

<em>    tem.append(a) </em>

<em />

#section 2<em>     </em>

<em>average = round(sum(tem)/len(tem),2) </em>

<em>print('The Average is ',average) </em>

<em>gdays=[] </em>

<em>for i in tem: </em>

<em>    if i > average: </em>

<em>        gdays.append(i) </em>

<em> </em>

<em>print('The following days are greater than the average: ',gdays)</em>

Explanation:

The above code is written in python 3

#section 1:

An input is gotten for number of days that is to be used in the calculation, and an array is created to hold the temperature that will be inputted into the program.

A range of values from [0 - (no_of_days - 1)] is created from the number of days entered, this is done so that the FOR loop can iterate through every number and call for inputs.

The FOR loop prompts the user for an input based on the range and passes that input to an integer data type before appending it to the tem array.

#section 2:

The sum of the new list and the length is used to calculate the average and the it is rounded up to 2 DP, The average is then printed to the screen.

Another FOR loop is used to check which of the days are greater than the average and passes it to another array (<em>gdays)</em>, this array is also printed to the screen.

check the attachment to see how the code works.

You might be interested in
What do people in japan use to make anime
lions [1.4K]

software programming like adobe flash.

8 0
3 years ago
25 POINTS!!!!!!!!!!!!!
Paladinen [302]
A leaking data exhaust
7 0
3 years ago
Read 2 more answers
You are going to visit a national park, and have never been there before. You are using a map to try and make the distance trave
Firdavs [7]

Answer:

eggs fishing didn't ysjffj

8 0
3 years ago
What does limited access to a document mean?
Vlad [161]

Answer:

D. It does not reflect any changes made in the document

Explanation:

A limited access is usually done by middle level and top level managers in an organisation to prevent other staff member to edit or make changes to confidential documents when they are out of the office, though the staff can read it, they can not make changes to it.

6 0
3 years ago
Read 2 more answers
Write a program that will calculate the following function:
anyanavicka [17]
Shshshshshshsjsjsjsjjsjdhdhhddhhd
8 0
3 years ago
Other questions:
  • must understand both art and engineering. a. industrial designer b. environmental designer c. interior designer d. graphic desig
    14·1 answer
  • ________ computers are specially designed computer chips that reside inside other devices, such as a car. Select one: A. Tablet
    11·2 answers
  • How much electricity is in the human brain? ​
    8·2 answers
  • People using commercially available software are usually asked to read and agree to a(n) _____
    10·1 answer
  • C:\windows\system32\drivers\etc\protocol is an example of a file ________. select one:
    5·1 answer
  • If you were required to give a speech identifying the risks of using computers and digital devices, which group of items would y
    7·1 answer
  • What are the origins of the parking barrier?
    12·1 answer
  • What is said to be the first mechanical calculator​
    7·2 answers
  • What are the four different orchestral instrument families?
    6·2 answers
  • What is the purpose of a project overview?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!