Median


#1

Could anybody solve this error? Thanks!


#2

on line 7, why length+1? it is perfect, look:

1 / 2 = 0
3 / 2 = 1
5 / 2 = 2
7 / 2 = 3

in case this calculation isn't clear, the first number is the length of the list, divided by 2 (obviously) which gives the index. if you think about it, the indexes perfectly match with the middle item.


#3

You're right, I worked it out :slight_smile:


#4