Your Perfect Assignment is Just a Click Away

We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!


CS 500 University Of Wisconsin Milwaukee Python Functions Finding Averages Lab

CS 500 University Of Wisconsin Milwaukee Python Functions Finding Averages Lab

A. Create a function called factorial that accepts an integer as an argument and returns the factorial of that integer. Do not print out anything in the factorial function. If the factorial function is called with a negative integer, a -1 is returned from the function. Do not prompt the user to enter a value. This will be taken care of by the tester program. Do not put anything else in this file except the factorial function (i.e. don’t put tester code in this file)

Make sure your function definition looks like this: def factorial(val):

B. Create a program that reads in integers and outputs the average of all of the numbers.

Some things to note:

  • Only integers will appear in the input file.
  • All of the integers in the input file will be separated by a space.
  • All integers will be on a single line.
  • Create a separate file called to solve this problem.
  • Do not read in from a specific file. If you are using the open function, you are doing this problem wrong.

C. create a Python program that reads in 2 integers that are separated by a space. There will only be 2 integers in the input file. Your program then prints out all of the prime numbers strictly between those 2 numbers in increasing order. If there are no prime numbers strictly between those 2 numbers, then a No Primes message is printed out. The order that the numbers were input does not matter.


Output: If there are no primes between the two numbers, your code outputs exactly:

No Primes

If there is one prime number, only that 1 number prints out.

If there are multiple prime numbers, the following pattern is used:


In other words, you separate the first number from the second number with a colon. You separate the second number from the third number with an exclamation point. You separate the third number from the fourth number with an ampersand. This delimiter pattern is repeated in subsequent numbers (colon, exclamation point, ampersand) until there are no more numbers left to be printed. There is no delimiter before the first element nor is there a delimiter after the last element. The numbers in the output should be in numerical order.

D. You are a manager for a global weather company and you have asked your regional offices to send you information in the following comma separated format:


All offices put a header row in each file to explain the data. A key thing is that the temperature should have been in Fahrenheit and located in the second to last column. Another key thing is that the wind should have been located in the last column and should have been in miles per hour. None of the offices sent the data exactly how you asked for it. Your job is to figure out what each of them did and then answer the following 2 questions:

  1. Take the average of all of the wind speeds for March, 2006. Which city had the closest wind speed to 8.30 mph?
  2. Take the average of all of the temperatures for 2006. Which city had the closest temperature, in fahrenheit, to 49.65.

The 4 cities are ABC, KLM, PQR and XYZ (see filenames). The way you clean the data and obtain the answers is entirely up to you with a couple of caveats. Any wind speed that is negative should be filtered out as this is not possible. Any temperature below -200 should be filtered out. Any wind speed that is listed as calm should be interpreted as 0mph or 0kph depending on the column header. Calm winds should not be filtered out. When filtering out data, only filter out the cell that is invalid, not the entire row. For example, if a row has a temperature of -9999 and a wind of 7.8, filter out the temperature but keep the wind value.

For this dirty data task, you only need to create a text file called answers.txt that contains the answer to each of the above questions. Any reasonable formatting of answers.txt is acceptable. You do not need to upload any code or explain how you obtained your answers for this final question.

Order Solution Now

Our Service Charter

1. Professional & Expert Writers: Fox Writers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Fox Writers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Fox Writers is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Fox Writers, we have put in place a team of experts who answer to all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.