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
5. Question<br> The control flag that isn't really in use by modern networks is the<br> flag.
Temka [501]

Answer:

The URG flag is a control flag which is not in use by the modern networks. Explanation: When a data has been prioritized within a segment and is required urgently, URG flag is being used.

8 0
3 years ago
Will give brainliest
Alex73 [517]

Answer:

B

Explanation:

Im a 100% sure.

5 0
2 years ago
Which of the following is NOT an advantage to using inheritance?
IrinaK [193]

Answer:

D)One big superclass can be used instead of many little classes.

Explanation:

Inheritance could be described as getting new class on another existing class with almost same execution,

inheritance allows codes to be re-used. It should be noted that inheritance bring about the code sharing among class.

The advantages of using inheritance includes but not limited to

✓ Code that is shared between classes needs to be written only once.

✓Similar classes can be made to behave consistently.

✓ Enhancements to a base class will automatically be applied to derived classes.

6 0
3 years ago
What is the best scenerio for
Stels [109]

Answer:

the teacher said a (dash) reads pages on website pls answer me now i have to write it now

5 0
2 years ago
Read 2 more answers
Four example of computer software?​
rodikova [14]

<em>answer</em><em>=</em><em> </em><em>safari</em><em>,</em><em> </em><em>ms</em><em>-</em><em>word</em><em>,</em><em> </em><em>moviemaker</em><em>,</em><em> </em><em>ms</em><em>-</em><em>pain</em><em>t</em><em>,</em><em> </em><em>firefox</em><em>,</em><em>etc</em><em>.</em><em>.</em><em>.</em>

5 0
3 years ago
Other questions:
  • A ____ database supports data distributed across several different sites.
    7·1 answer
  • Hosts A and B are communicating over a TCP connection, and Host B has already received from A all bytes up through byte 126. Sup
    10·1 answer
  • The company where Derek works has tasked him with setting up and securing a SOHO router. He wants to make sure the wireless netw
    7·1 answer
  • My computer just fried anybody know why it did that?
    14·2 answers
  • A _______ template is used to maintain consistency in terms of margins and page numbers .
    6·1 answer
  • Create a program that finds (n+1)! -factorial- of an integer n in C++.
    13·1 answer
  • When writing code, how can printing be useful?
    15·1 answer
  • Write a Java program that has a static method named range that takes an array of integers as a parameter and returns the range o
    10·1 answer
  • Paul wants to store addresses and phone numbers for clients. Paul wants to use this information to send form letters. Paul shoul
    5·1 answer
  • Scientist Galileo Galilei used the
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!