Created
August 9, 2016 01:15
-
-
Save andymccurdy/ec110381a2dab1f689e995c198030ae2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def purify(numbers): | |
return [i for i in numbers if i % 2 == 0] |
def median(x):
med_list = sorted(x)
if len(med_list) % 2 == 1:
return the middle index
else:
figure out how to divide the middle indexes and return it
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Essentially, I need to put the numbers that come through 'x' into a list. Next I need to sort said list...which I believe i've done both. Now what I don't know how to do is take the middle number, or if it's an even value of numbers, taking the middle two numbers, dividing them, and outputting the median.