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 method of thermal energy is at work when heat lamps are used to warm up baby chickens?
adelina 88 [10]

Answer:

Radiation

Explanation:

4 0
3 years ago
Read 2 more answers
A reasonable documentation comment for this program might be public class Questions1_4 { public static void main(String[ ] args)
katrin [286]

Answer:

//The class definition

public class Questions1_4 {

   // main method is defined which signify beginning of program execution

   public static void main(String[ ] args) {

       // The word "here" is displayed

       System.out.print("Here");

       // The word "there" is concatenated with "everywhere"

       System.out.println("There " + "Everywhere");

       // The word "But not" is concatenated with "in Texas"

       System.out.println("But not" + "in Texas");

       

   }

   

}

Explanation:

The program try to show the use of string concatenation. In the code snippet, the last two output statement display string by concatenating them.

The first print statement display "Here" without ending with a new line. The next print statement display "There Everywhere" by concatenating "There" with "Everywhere". The last print statement display "But not in Texas" by concatenating "But not" and "in Texas".

String concatenation means joining pair of string together to form a single string. The "+" operator represent string concatenation in the print statement.

7 0
3 years ago
Scientist Galileo Galilei used the
marshall27 [118]

Scientist Galileo Galilei used the telescope to observe the stars and planets.

<h3>What was the story of Scientist Galileo Galilei?</h3>

Galileo was a natural philosopher, astronomer, and mathematician who made major contributions to the creation of the scientific method and the disciplines of motion, astronomy, and strength of materials.

He also made ground-breaking telescopic discoveries, such as the discovery of Jupiter's four biggest moons.

Hence the correct option is A

Learn more about Scientist Galileo Galilei:

brainly.com/question/12024475

#SPJ1

4 0
2 years ago
1. The running configuration is also known as the _____________ (Select Two) a. Startup config b. Working configuration c. Curre
Shtirlitz [24]

Answer:

1. The running configuration is also known as the <u><em>b. working configuration</em></u>

<u><em>c. current configuration</em></u>

Explanation:

hopes this help (:

6 0
2 years ago
Abby has always dreamed of having her own ice cream shop. Now as a young entrepreneur she has decided to pursue her dream, but s
antoniya [11.8K]

Answer:

Abby LEE Miller UWUWUWUWUWWUUWUW

3 0
3 years ago
Other questions:
  • What can be determined from this selection? Check all that apply. The Tax Info worksheet is currently being viewed. There are th
    6·2 answers
  • What do you call the combination of title, description, tags, and thumbnail?
    6·1 answer
  • A student who sets a date to finish a goal is using which SMART goal? relevant, specific, attainable or timely
    10·1 answer
  • Consider the following method:
    8·2 answers
  • A) A cable that is mainly used in the cable television network
    11·1 answer
  • Blank includes websites that encourage interaction and connection among people businesses and organizations
    14·2 answers
  • Project manager George is defining project management to his team. How should he define project management in one sentence?
    7·1 answer
  • Which of these is not a valid form<br>layout in Microsoft Access?​
    11·1 answer
  • Modern life is not possible if computer stops working? Give your opinion<br>​
    7·1 answer
  • The math function ceil(x) returns the smallest integer that is greater than or equal to x. True False
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!