Question: PYTHON: Write a function called median. It is passed a set of numbers, and returns their median. Recall that the median of a set of
PYTHON:
Write a function called median. It is passed a set of numbers, and returns their median. Recall that the median of a set of numbers is the value separating the higher half of the set from the lower half. In simple terms, it may be thought of as the "middle" value of a data set. We will compute the median as follows:
(i) if the set has an odd number of members, then the same number of members are smaller than the median as are larger;
(ii) if the set has an even number of members, then we will define the median such that the number of members smaller than the median is one less than the number of greater members. For example:
>>> median({2, 4, 6, 8, 10})
6
>>> median({0, 2, 4, 6, 8, 10})
4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
