This is probably the first exercise that I did all on my own without looking up any help. So, I'm very happy to have made this progress with Python. However, I know that this could've probably been done with less lines and much simpler.
Any suggestions on how this could have been done with less lines? I'm looking to improve on my "noob" skills.
def median(data): newlist = sorted(data) size = len(newlist) oddmedian= (size -1)/2 if size%2 == 0: b = size / 2 c = b - 1 second_digit = newlist[b] first_digit = newlist[c] median = (second_digit + first_digit)/2.0 return median elif size % 2 == 1: return newlist[oddmedian]