Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PYTHON IS3073 1. A group of statisticians at a local college has asked you to cr

ID: 3072698 • Letter: P

Question

PYTHON IS3073

1. A group of statisticians at a local college has asked you to create a set of functions that compute the median and mode of a set of numbers, as defined in Section 5.4. Define these functions in a module named stats.py. Also include a function named mean, which computes the average of a set of numbers. Each function should expect a list of numbers as an argument and return a single number. Each function should return 0 if the list is empty. Include a main function that tests the three statistical functions with a given list.

7. Write a program that inputs a text file. The program should print the unique words in the file in alphabetical order.

8. A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a file. The program should output the unique words and their frequencies in alphabetical order. Variations are to track sequences of two words and their frequencies, or n words and their frequencies.

Explanation / Answer

1) The Python code to compute mean, median and mode of a set of data is given below.

Input the data as an array to each functions.

The output is:

The mean is: 5.333333333333333

The median is: 5.5

There is not a mode

The mode is: 0

We are required to answer only one question. Post the remaining questions as another post.