<jupyter_start><jupyter_text>Exercise 1Your task is to write a Python script to do the following:1. Read data from the file `prog_data.txt` into a list.  + Note:  Data in this file comes from the course survey.  The numbers represent the level of programming confidence that students had coming into the course on a scale of 1 to 5.2. Using the `enumerate` build-in type, perform a `for` loop to convert elements in the list from ints to floats.  + Remember that data will be read in as a string type.  You will do calculations which require floats.  To convert from a string to a float just do float(string).  However, note that this only works sometimes: [How to convert data types in Python 3](https://www.digitalocean.com/community/tutorials/how-to-convert-data-types-in-python-3).  It will work in our current use case.3. Using the `Counter` method from the `collections` library, determine what the most common number in your list is.  + Hint:  You will need to access the first element of the list returned by the `Counter` method.4. Print out the following for the user:  + Total number of respondents (suggestions: use the `len` function)  + Maximum number in the list (suggestion: use the `max` function)  + Minimum number in the list (suggestion: use the `min` function)  + Median of list (suggestion: use `numpy` --- look up median in `numpy`)  + Mean of list (suggestion: use `numpy` --- look up mean in `numpy`)  + Most common number in list with number of times it occurs.Note:  Please don't write a function to do this.  A script is sufficient for this exercise.  We'll get to functions soon.Your output should look something like:> The total number of respondants is 45.> The maximum programming confidence is 5.0.> The minimum programming confidence is 1.0.> The median programming level is 4.0.> The mean programming level is 3.4.> The most common programming level is 4.0 with 17 respondants.<jupyter_code>f_prog_data = open("prog_data.txt") # Open the file
lines = f_prog_data.readlines()
li_prog_data = []
for line in lines:
    line = line.replace('\n', '')
    li_prog_data.append(float(line))
print(li_prog_data)
# using the enuerate to convert elements in the list from ints to floats
li_prog_data_v2 = list()
for k, v in enumerate(lines):
    li_prog_data_v2.append(float(v))
print(li_prog_data_v2)
import collections as col
counter = col.Counter(li_prog_data)
most_common_value = counter.most_common()[0][0]
 
print('The most common number in your list is ', most_common_value)
print('The number of occurance for this most common number is ', counter[most_common_value])
import numpy as np
print('The total number of respondants is ', len(li_prog_data))
print('The maximum programming confidence is ', max(li_prog_data))
print('The minimum programming confidence is ', min(li_prog_data))
print('The median programming level is ', np.median(li_prog_data))
print('The mean programming level is ', np.mean(li_prog_data))
print('The most common programming level is %.1f with %d respondants.' % (most_common_value, counter[most_common_value]))<jupyter_output>The total number of respondants is  45
The maximum programming confidence is  5.0
The minimum programming confidence is  1.0
The median programming level is  4.0
The mean programming level is  3.4
The most common programming level is 4.0 with 17 respondants.
{'fraction_non_alphanumeric': 0.07871894642322658, 'fraction_numerical': 0.012870398084405866, 'mean_word_length': 4.712820512820513, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 10, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '38530', 'license': 'MIT', 'n_tokens_mistral': 982, 'n_tokens_neox': 930, 'n_words': 447, 'path': 'lectures/L4/Exercise_1-final.ipynb', 'repo_name': 'JasmineeeeeTONG/CS207_coursework', 'size': '3341'}