Question: Using Python in the Jup. Notebook, write the function. Problem 2) 5 test cases, 1 point for each passed test case. (5 points total) Using
Using Python in the Jup. Notebook, write the function.



Problem 2) 5 test cases, 1 point for each passed test case. (5 points total) Using Python in the Jup. Notebook, write a function called q summary Vl which takes as input: numbers - a list of numbers The function q summary VI should return a dictionary containing the min, Q1, Q2, Q3, and max. Feel free to utilize the numpy function for quantile instead of implementing the formulas to calculate index positions that we reviewed in class. You will not lose credit for using numpy or for using default python, however, your answers should be correct either way. q_summary_V1 should also warn the user if there are any outliers by printing them to the screen. The following screenshot shows an example function call: These are the two test cases that you should pass to gain 2/5 points as well. grades = sorted([0, 0, 14, 35, 91, 100, 81, 77, 75, 66, 78, 80, 81, 63, 87, 90, 89]) print(q_summary_v1(grades)) The following are outliers: [0, 0, 14] {'min': 35, 'qi': 63.0, '92': 78.0, '93': 87.8, 'max': 100} times = [5, 10, 10, 15, 15, 15, 15, 20, 20, 20, 25, 30, 30, 40, 40, 45, 60, 60, 65, 89] print(q_summary_v1(times)) The following are outliers: [89] {'min': 5, 91': 15.0, '92': 22.5, '93': 41.25, 'max': 65} Problem 3) 5 test cases, 1 point for each passed test case. (5 points total) Using the sample of travel times data set from class, the answers using numpy are incorrect. In fact, there are many ways to calculate via interpolation. Please refer to this link, which offers an explanation as to why there are many ways to retrieve the index. In this class, we will use the formula provided for consistency. To see the difference, please alter your code from Problem 2 and make a new function called q_summary_V2 which should perform exactly the same thing as q_summary_V1, but via the method from class. The following are the test cases you will need to pass in order to gain 2/5 points. grades = sorted([0, 0, 14, 35, 91, 100, 81, 77, 75, 66, 78, 80, 81, 63, 87, 90, 89]) print(q_summary_V2(grades) {'min': 0, '91': 49.0, '92': 78, '93': 88.0, 'max': 100} times = [5, 10, 10, 15, 15, 15, 15, 20, 20, 20, 25, 30, 30, 40, 40, 45, 68, 60, 65, 89] print(q_summary_V2(times)) The following are outliers: [89] {'min': 5, 91': 15.0, '92': 22.5, '93': 43.75, 'max': 65} Problem 2) 5 test cases, 1 point for each passed test case. (5 points total) Using Python in the Jup. Notebook, write a function called q summary Vl which takes as input: numbers - a list of numbers The function q summary VI should return a dictionary containing the min, Q1, Q2, Q3, and max. Feel free to utilize the numpy function for quantile instead of implementing the formulas to calculate index positions that we reviewed in class. You will not lose credit for using numpy or for using default python, however, your answers should be correct either way. q_summary_V1 should also warn the user if there are any outliers by printing them to the screen. The following screenshot shows an example function call: These are the two test cases that you should pass to gain 2/5 points as well. grades = sorted([0, 0, 14, 35, 91, 100, 81, 77, 75, 66, 78, 80, 81, 63, 87, 90, 89]) print(q_summary_v1(grades)) The following are outliers: [0, 0, 14] {'min': 35, 'qi': 63.0, '92': 78.0, '93': 87.8, 'max': 100} times = [5, 10, 10, 15, 15, 15, 15, 20, 20, 20, 25, 30, 30, 40, 40, 45, 60, 60, 65, 89] print(q_summary_v1(times)) The following are outliers: [89] {'min': 5, 91': 15.0, '92': 22.5, '93': 41.25, 'max': 65} Problem 3) 5 test cases, 1 point for each passed test case. (5 points total) Using the sample of travel times data set from class, the answers using numpy are incorrect. In fact, there are many ways to calculate via interpolation. Please refer to this link, which offers an explanation as to why there are many ways to retrieve the index. In this class, we will use the formula provided for consistency. To see the difference, please alter your code from Problem 2 and make a new function called q_summary_V2 which should perform exactly the same thing as q_summary_V1, but via the method from class. The following are the test cases you will need to pass in order to gain 2/5 points. grades = sorted([0, 0, 14, 35, 91, 100, 81, 77, 75, 66, 78, 80, 81, 63, 87, 90, 89]) print(q_summary_V2(grades) {'min': 0, '91': 49.0, '92': 78, '93': 88.0, 'max': 100} times = [5, 10, 10, 15, 15, 15, 15, 20, 20, 20, 25, 30, 30, 40, 40, 45, 68, 60, 65, 89] print(q_summary_V2(times)) The following are outliers: [89] {'min': 5, 91': 15.0, '92': 22.5, '93': 43.75, 'max': 65}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
