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
What is the purpose of quick access toolbar?
Flauer [41]
Answer:

Toolbar grants direct (quick) access to a set of desired commands in a toolbar that is always visible no matter which ribbon tab is selected.

Explanation:


Given
8 0
1 year ago
Advantages of e commerce
Sloan [31]

Answer:

A Larger Market

Customer Insights Through Tracking And Analytics

Fast Response To Consumer Trends And Market Demand

Lower Cost

More Opportunities To "Sell"

Personalized Messaging

Hope this helps!

4 0
3 years ago
Date
IRISSAK [1]

Answer:

computer is an electronic machine that accept raw data ,process and then give result. it's uses:

It is used for storing data and information.

5 0
2 years ago
Is permanent software programmed into read-only memory.<br> Firmware<br> JavaScript<br> PHP<br> o
velikii [3]
Firmware is the software
5 0
2 years ago
Is it possible for the front and rear references in a circular array implementation to be equal?
azamat

Answer:

Yes it is possible for the following cases:-

  1. When the queue is full.
  2. When the queue is empty.

Explanation:

When the queue is full the the front and the rear references in the circular array implementation are equal because after inserting an element in the queue we increase the rear pointer.So when inserting the last element the rear pointer will be increased and it will become equal to front pointer.

When the queue is empty the front and rear pointer are equal.We remove an element from queue by deleting the element at front pointer decreasing the front pointer when there is only one element and we are deleting that element front and rear pointer will become equal after deleting that element.

7 0
2 years ago
Other questions:
  • Exterior brick veneers are used to support the entire weight of the roof structure
    12·2 answers
  • My computer have black spots and line
    7·2 answers
  • SQL a. has become the de facto standard database language b. can be used to define database systems c. both a. and b. d. none of
    10·1 answer
  • When you use the fill handle to copy a formula to adjacent cells, this creates what kind of cell reference?
    5·1 answer
  • Another pitfall cited in Section 1.10 is expecting to improve the overall performance of a computer by improving only one aspect
    13·1 answer
  • Which information purpose uses video from a security camera?
    15·1 answer
  • My feelings alwayss T-T
    14·2 answers
  • What is the purpose of file extensions? A. They execute the mail merge function, B. They tell the operating system what kind of
    15·2 answers
  • Where did the name "QWERTY" come from?​
    9·1 answer
  • WILL GIVE BRAILIEST
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!