IT 116: Introduction to Scripting
Homework 11

Due Sunday, December 3rd at 11:59 PM

Deliverables

There is one deliverable for this assignment: It must be in an hw11 directory, which you must create inside a hw directory inside you it116 directory.

Make sure the script obeys all the rules in the Script Requirements page.

Copy the file numbs.txt, which you will find in /home/ghoffman/course_files/it116_files into your hw11 directory .

Specification

The script must define 4 functions You must not use any external Python module in the statistical calculations needed for these functions.

read_file_into_integer_list

This functions must have the following header
    read_file_into_integer_list(filename)
This function must read in the numbers contained in a file, convert them to integers and add them to an array.
The function must return the array of integers it creates.

list_mean

This functions must have the following header
    def list_mean(list):
This function must calculate the average (mean) of the integers in a list.
It must return the the rounded average.

list_median

This functions must have the following header
    def list_median(list):
This function must sort a list and return the value of the element in the middle of the list.

list_range

This functions must have the following header
    def list_range(list):
This function must return the difference between the highest and lowest number in a list.

Run code

At the bottom of the script you must have the following code
numbers = read_file_into_integer_list("numbs.txt")
print("numbers:             ", numbers)
print("list_mean(numbers):  ", list_mean(numbers))
numbers.sort()
print("numbers:             ", numbers)
print("list_median(numbers):", list_median(numbers))
print("list_range(numbers): ", list_range(numbers))

Testing

Your output should look like this
numbers:              [46, 19, 35, 43, 35, 33, 42, 6, 25, 6, 19, 17, 31, 1, 23, 14, 18, 24, 24]
list_mean(numbers):   24
numbers:              [1, 6, 6, 14, 17, 18, 19, 19, 23, 24, 24, 25, 31, 33, 35, 35, 42, 43, 46]
list_median(numbers): 24
list_range(numbers):  45
Be sure to run this script on the Unix machine so you know it works in the environment in which I will run it when I score your homework.