I get the error-message: "Oops, try again. median([4, 5, 5, 4]) resulted in an error: object of type 'int' has no len()"
Why is it like this? My first idea was to slice it, and now that I failed I did it like the hint suggested. Still, it would be nice to know if there is a way to complete this exercise while slicing! (Even if my code is wrong, please tell me how) Any help is appreciated!
def median(numList): numList = sorted(numList) if len(numList)%2==0: while len(numList)>2: numList=numList[1:] numList=numList[-1] result = float((numList+numList/2)) return result else: while len(numList)>2: numList=numList[1:] numList=numList[-1] return numList