15/15


#1

def median (numbers):
**** num_list = sorted(numbers)
**** if len(num_list) % 2 == 0:
******** result = (len(num_list)/2 + (len(num_list)/2 - 1))/2.0
******** return result
**** else:
******** result = num_list[len(num_list)%2]
******** return result

help plz, i get an error saying 'list index our of range'


#2

def median(a):
n = sorted(a)
med1 = n[len(n) / 2]
med2 = n[(len(n)-1)/ 2]
print n
if len(n) % 2 == 0:
med = (med1 + med2) / 2.0
return med
else:
med = float(med1)
return med

print median([7,12,3,1,6])

this worked for me