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]
3 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]3 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
Which of the following storage devices allows access to information in a sequential mode?
katrin [286]
It is either hard drive or solid state drive
4 0
3 years ago
Read 2 more answers
Which type of link is normally used to interconnect two peripheral modules (pm) in the digital multiplex system (dms)?
natta225 [31]

The answer is DS-30A. The Roland DS30A is a 24-bit Digital Reference Monitor which can add pristine 24-bit/96kHz. They are small speakers.

4 0
3 years ago
A single instruction carried out by a computer is called a what?
pochemuha

Answer:

in computer science, an instruction is a single operation of a processor defined by the instruction set

Explanation:

if you need anymore help let me know :)

6 0
3 years ago
Which is the another name of automatic sequence control calculator​
Alla [95]

Answer:

IBM Automatic Sequence Controlled Calculator (ASCC)

3 0
3 years ago
What is wrong with the formula below? SUM(A1:A5)/SUM(B1:B5)
Triss [41]
I think the answer would be C
5 0
3 years ago
Read 2 more answers
Other questions:
  • Given the following code, what will be the value of finalAmount when it is displayed? public class Order { private int orderNum;
    7·1 answer
  • What is Software? Write the functions of Software?​
    11·1 answer
  • LOOK TO THE LEFT AND RIGHT BEFORE ENTERING ANY INTERSECTION ON A GREEN LIGHT BECAUSE:
    12·2 answers
  • ________ enables advertisers to display more relevant ads based on user's search and browsing history. FIP NORA A Web bug An int
    10·1 answer
  • A JOB LEADS SOURCE LIST is used to help record all of the job leads you can find. It includes contact information and a plan for
    8·1 answer
  • Who were called “freedmen” during the reconstruction period?
    15·2 answers
  • Javier develops sophisticated fashion websites. He has been asked by the owner of a leading fashion brand to create web content
    13·1 answer
  • Privacy Group of answer choices must be respected if we are to function as complete, self-governing agents is an absolute value
    5·1 answer
  • Array testGrades contains NUM_VALS test scores. Write a for loop that sets sumExtra to the total extra credit received. Full cre
    11·1 answer
  • Which of the following examples can be solved with unsupervised learning?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!