https://www.codecademy.com/courses/learn-python-3/articles/advanced-python-code-challenges-lists

hello everyone, I’m trying to solve challenge #5 where you are supposed to return the middle element of a list if there is an odd number of elements or the average of the two middle elements if it is even.

Here is my code:

#Write your function here

def middle_element(lst):

if len(lst) % 2 != 0:

mid = (len(lst) - 1) / 2

return lst[int(mid)]

else:

m1 = ((len(lst) / 2) - 1

m2 = ((len(lst) / 2)

return (m1 + m2) / 2

print(middle_element([5, 2, -10, -4, 4, 5]))

For some reason I am getting a syntax error for the variable titled m2. Anyone know why I am receiving this error?