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
Consider the partially-filled array named a. What does the following loop do? (cin is a Scanner object)
Jlenok [28]

Answer:

3. Reads up to 3 values and places them in the array in the unused space.

Explanation:

cin.NextInt() reads the next value from the Scanner.

The while is just while the size is lesser than the capacity and the value is positive. It may read up to 3 values, and puts at the position size; Size starts at 3, that is, the first index which the value is 0, and goes up to 5. So it is the unused positions.

The correct answer is:

3. Reads up to 3 values and places them in the array in the unused space.

3 0
3 years ago
The incandescent test lamp is used to check for the presence of A. AC current. B. DC voltage. C. DC current.
andriy [413]
Incandescent test lamps are used to check for Alternating Current Voltage and Direct Current Voltage. 

The answer is AC Voltage and DC Voltage. 
5 0
3 years ago
Read 2 more answers
HURRY
Irina-Kira [14]

<em>Your answer is B: cooperative player-to-player interaction</em>

<em></em>

<em></em>

<em />

6 0
3 years ago
As an interviewer, it is not necessary to be at eye level with interviewee<br><br> True<br> False
Tamiku [17]

Answer:

True

Explanation:

Have a great day

3 0
3 years ago
Read 2 more answers
Pls help me this quation give me the answer Do you think that dealing with big data demands high ethical regulations, accountabi
jarptica [38.1K]

Answer:

yes, in case of big data demand it's duty of person as well as company to follow ethical principal and adhere the moral standard for keeping the information of the big data company confidential.

Explanation:

may it's help you

6 0
3 years ago
Other questions:
  • Match the following technologies with their applications.
    9·1 answer
  • If I delete the emoji free app will I still have the emojis on my phone?
    13·2 answers
  • Someone receives and email that appears to be from their bank requesting them to verify account information, this type of attack
    10·1 answer
  • Devon keeps his commitments, submits work when it's due, and shows up when scheduled. What personal skill does Devon
    15·2 answers
  • Through the use of computational thinking techniques, models and algorithms can be created. A(n) ___1___ can be created that rep
    12·2 answers
  • Identify disadvantages that web designers encountered when using tables for page layout. Check all of the boxes that apply.
    10·2 answers
  • How are computers connected to one another?
    5·2 answers
  • 100 POINTS PLEASE HELP Type the correct answer in the box. Spell all words correctly.
    15·1 answer
  • Question # 2 Multiple Select You wrote a program to compare the portion of drivers who were on the phone. Which statements are t
    6·1 answer
  • What type of storage drive contains multiple spinning platters?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!