Hi,

Depressingly I can’t understand the solution for the even handling (which doesn’t fill me with confidence regarding my understanding so far!)

Solution given as:

def middle_element(lst):

if len(lst) % 2 == 0:

sum = lst[int(len(lst)/2)] + lst[int(len(lst)/2) - 1]

return sum / 2

else:

return lst[int(len(lst)/2)]

Since the list is six elements long I would expect it to run the even option which is meant to return the average of the middle two elements which apparently is -7 and for the life of me I cannot understand how it is computing that from the sum. Any explanations for someone who apparently cannot even understand a solution would be great - to say please simplify your explanation would be an understatement!

Thank you in advance, I will go back to making cave drawings in the meantime.