Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Python Expert

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.

Python, Programming

  • Category:- Python
  • Reference No.:- M92286240
  • Price:- $45

Priced at Now at $45, Verified Solution

Have any Question?


Related Questions in Python

Below zero - ice cream storethe local ice-cream store needs

Below Zero - ice cream store The local ice-cream store needs a new ordering system to improve customer service by streamlining the ordering process. The manager of the store has found that many orders are incorrect and s ...

Part i the assignment filesone of the most important

Part I: The Assignment Files One of the most important outcomes of this assignment is that you understand the importance of testing. This assignment will follow an iterative development cycle. That means you will write a ...

The second task in this assignment is to create a python

The second task in this assignment is to create a Python program called pancakes.py that will determine the final order of a stack of pancakes after a series of flips.(PYTHON 3) Problem Task In this problem, your input w ...

Simple python traffic lightswrite a program that simulates

Simple Python (Traffic lights) Write a program that simulates a traffic light. The program lets the user select one of three lights: red, yellow, or green. When a radio button is selected, the light is turned on, and onl ...

In this programming assignment you will write a client

In this programming assignment, you will write a client pingprogram in Python. Your client will send a simple ping message to a server, receive a correspondingpong message back from the server, and determine the delay be ...

Homework -this homework will have both a short written and

Homework - This homework will have, both a short written and coding assignment. The problems that are supposed to be written are clearly marked. 1) (Written) Make heuristics Describe two heuristics for the slide problem ...

Questionwhat is a python development frameworkgive 3

Question What is a python development framework? Give 3 examples python development framework used today. and explain which development framework is used in which industry.

Question research pythons dictionary data type dictdiscuss

Question : Research Python's dictionary data type (dict). Discuss its interface and usage. Include examples. Discuss practical applications of dictionaries.

Project reconnaissance and attack on ics

Project: Reconnaissance and Attack on ICS NetworksEnvironment Setup The second mini project will be based on Industrial Network Protocols, specifically the Modbus protocol. Please follow the instructions carefully to set ...

Foundations of programming assignment - feduni bankingthis

Foundations of Programming Assignment - FedUni Banking This assignment will test your skills in designing and programming applications to specification. Assignment Overview - You are tasked with creating an application t ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As