# Write the Python function that accepts a list of numerics as an argument and returns the average of the list elements.

Q1 Finding the average weather temperature ( coded temperatures, for example, the mean  could have been subtracted from each actual temperature)

Scenario: Given a list of weather temperatures in fahrenheit coded as follows:

weatherF = [ 1, 3, 1, 5, 3, 3, 2, 1, 1,  4, 4 ,4, 1, 1, 1 ] # note these are the ‘coded’ temperatures

Write the Python code to calculate the average temperature for the weatherF list, doing it two ways. Use the ‘len’ function to get the length of an array, don’t manually count. Use this ‘len’ function to determine maxIndex as well as the denominator for the average calculation. Avoid magic numbers..

A :Write a Python program to calculate the average temperature using a while loop and using indexes to get the element temperatures

Print out the temperature at each iteration. Print the average temperature after the loop terminates.

B : Write a  Python program  to calculate the average temperature using a for loop

Print out the temperature at each iteration. Print the average temperature after the loop terminates.

Q2 : Finding the frequency distribution of the temperatures

Write a Python program to find the frequency distribution of the temperatures.

That is, weatherF is a list of temperatures: how many times does the temperature value of ‘1’ occur? Manually, I can see it occurs 7 times, but I want to automate that analysis.

To start off, name your  frequency distribution list as frequencyDistribution.

Hints: How many different values of elements must it hold?  That will be its size.

The frequencyDistribution  element should be ‘7’, that is, there are ‘7’ ones. What should the other indices hold?

Use  a for loop to go through weatherF list, and for each element encountered, bump the contents of the frequencyDistribution array index holding that element ‘s value. That is, for example,  frequencyDistribution ‘s contents will be bumped 7 times, which equals the number of ‘1’ s encountered.

Q3 : Write a Python program to find the max and min of the weatherF list. Print those out at the termination of the loop. ( use either style you like)

Use constants to represent the initial max and min values.

Q4 : Write the Python function that accepts a list of numerics as an argument and returns the average of the list elements. Note, this is a generalization of what you did in question Q1. Now the list is just a list of numbers. Hint, use the ‘len’ function to determine the denominator for the aver

## Latest posts

### In Week Two, you created a systems thinking diagram that mapped the stock, inflows, outflows, and feedback loops of an organization. As you become more familiar with your environment and the relations

In Week Two, you created a systems thinking diagram that mapped the stock, inflows,...

### Psychology Journal (Applying Lifespan Development To Life)

In this journal,

Reflect on the knowledge, based on theories of development, you have learned...

### Mossler and Ziegler (2019) suggest numerous variables that attribute to successful aging: selection processes

Mossler and Ziegler (2019) suggest numerous variables that attribute to successful aging: selection processes...

### Scenario 2: Article and Project Fit Analysis for the PMO Director, Due Week 3

Scenario #2 (Analysis Email - Individual)

UMUC IFSM 441

Scenario 2: Article and Project Fit Analysis...

### How can CVP analysis be used to predict future costs and profitability? Describe how CVP analysis is used, or could be used, at your current place of employment. If you have not worked for a

How can CVP analysis be used to predict future costs and profitability? Describe how...