Question: Only python built-in library is allowed Problem 2 Define a function called iqr(x) that satisfies the following criteria: - Calculates and returns the interquartile range
Only python built-in library is allowed

Problem 2 Define a function called iqr(x) that satisfies the following criteria: - Calculates and returns the interquartile range (IQR) of an iterable x - The IQR is the difference (Q3 - Q1) where Q1 and Q3 are the first and third quartiles - In an even-length list of 2n numbers, Q1 and Q3 are the median of the smallest n numbers and the median of the largest n numbers, respectively - In an odd-length list of 2n+1 numbers, Q1 and Q3 are the median of the smallest n+1 numbers and the median of the largest n+1 numbers, respectively - A dataset with one or fewer numbers has an IQR of 0 - You may assume x contains only numeric elements Examples: In : iqr([1,2,3,4,5])#Q1=2,Q3=4 Out: 2.0 In : iqr([1,2,3,4,5,6])#Q1=2,Q3=5 Out: 3.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
