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 program that uses a bar

Write a program that uses a bar chart to display the percent-ages of the overall grade represented by the project, quizzes the midterm exam and the final exam

  Implement your algorithm in python

Write a Python program that, for every transaction, takes input on the customer ID and the total sale amount in the transaction.

  Write a program that accepts as input a sentence

Write a program that accepts as input a sentence in which all of the words are run together but the first character of each word is uppercase. Convert the sentence to a string in which the words are separated by space and only the first word start..

  Function should return a dictionary

Write a function numOccur(s), where s is a string; the function should return a dictionary whose keys are the 26 ascii letters abcdefghijklmnopqrstuvwxyz

  Part-1for task 1 list the things you changed and the

part-1for task 1 list the things you changed and the purpose of changing it. good reasons include making code easier

  Develop program which reads data file containing information

In this assignment you will write a program which reads a data file containing information in different formats, validates this data, and prints out a report incorporating this data.

  Write a program using python to implement a password cracker

Write a program using Python to implement a password cracker for Linux. You should utilize a dictionary (small - English) to crack the password.

  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.

  Create a cheat commands in the game

ISCG5420 Programming Fundamentals - Create a cheat commands in the game so player can pick up any item he wants from any location in the map.

  Asign true to the variable has_dups

Asign True to the variable has_dups if the string s1 has any duplicate character (that is if any character appears more than once) and False otherwise

  Find the number of vowels in the string

Using list and one definition for find the Number of vowels in the String.

  Python code for grabbing data from yahoo finance

I am new to Phython. Using Spyder IDE Simple code. It is not recognizing by Data file see line 33 - The purpose of assignment is to get you familiar with the Python.

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