Write a python program to calculate the average temperature

Assignment Help Python Programming
Reference no: EM131477503

Assignment

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[0] 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[0] ‘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.

Reference no: EM131477503

Questions Cloud

Develop a pl-sql anonymous block that displays total sales : Develop a PL/SQL anonymous block that displays the total sales for a zip code for a specific zip code. You may use any of your zip codes you wish.
Discuss the psychological stresses of captivity : Discussing the psychological stresses of captivity, coping mechanisms of the POW experience.
Is a relevant cost in deciding whether to continue drilling : An international oil company spent $1 million drilling a dry hole when searching for oil. An official argues that the company should continue drilling.
Identify type of ddos attack and justify in detail : BN203-Using the given DDoS attack diagram in Figure 1, identify type of DDoS attack and justify in detail how this attack will affects the Victim's workstation.
Write a python program to calculate the average temperature : Write a Python program to calculate the average temperature using a for loop. Finding the frequency distribution of the temperatures.
How does dcf valuation differ from relative valuation : Why should a financial manager understand the valuation process?
What about this pillar is especially interesting to you : What similarities do you see between this week's highlighted religious traditions? How do the cosmogonies surrounding death and the afterlife differ?
What do you think it was like in medieval cities : What do you think it was like in medieval cities? Are there any conditions that you might have enjoyed more than what we experience in our lives today?
How would you describe the location of the organization : COMM 7200 - Spring 2017 Organization Communication in Diverse Contexts. How would you describe the location of the organization

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd