#Create a function that returns the median of a list of numbers
def median(list_of_numbers):
#Make a copy of list_of_numbers and sort the new list
lst = list_of_numbers
lst = sorted(lst)
#Get the length of list and use it to index through the list
lst_length = len(lst)
index = int(lst_length/2)
#If length if even, average the two middle numbers
if lst_length%2==0:
a= lst[index-1]
b = lst[index]
result = (a+b)/2
#If length is odd, return the middle number
else:
result = lst[index]
return result
print (median([4, 5, 5, 4]))
I0NyZWF0ZSBhIGZ1bmN0aW9uIHRoYXQgcmV0dXJucyB0aGUgbWVkaWFuIG9mIGEgbGlzdCBvZiBudW1iZXJzCmRlZiBtZWRpYW4obGlzdF9vZl9udW1iZXJzKToKCiNNYWtlIGEgY29weSBvZiBsaXN0X29mX251bWJlcnMgYW5kIHNvcnQgdGhlIG5ldyBsaXN0CiAgICBsc3QgPSBsaXN0X29mX251bWJlcnMKICAgIGxzdCA9IHNvcnRlZChsc3QpCgojR2V0IHRoZSBsZW5ndGggb2YgbGlzdCBhbmQgdXNlIGl0IHRvIGluZGV4IHRocm91Z2ggdGhlIGxpc3QKICAgIGxzdF9sZW5ndGggPSBsZW4obHN0KQogICAgaW5kZXggPSBpbnQobHN0X2xlbmd0aC8yKQoKI0lmIGxlbmd0aCBpZiBldmVuLCBhdmVyYWdlIHRoZSB0d28gbWlkZGxlIG51bWJlcnMKICAgIGlmIGxzdF9sZW5ndGglMj09MDoKICAgICAgICBhPSAgbHN0W2luZGV4LTFdCiAgICAgICAgYiA9IGxzdFtpbmRleF0KICAgICAgICByZXN1bHQgPSAoYStiKS8yCgojSWYgbGVuZ3RoIGlzIG9kZCwgcmV0dXJuIHRoZSBtaWRkbGUgbnVtYmVyCiAgICBlbHNlOgogICAgICAgIHJlc3VsdCA9IGxzdFtpbmRleF0KICAgIHJldHVybiByZXN1bHQKCnByaW50IChtZWRpYW4oWzQsIDUsIDUsIDRdKSk=