Https://www.codecademy.com/courses/learn-python/lessons/practice-makes-perfect/exercises/median

Hello fellow colleagues,

https://www.codecademy.com/courses/learn-python/lessons/practice-makes-perfect/exercises/median

Why am l getting this syntax error,please explain

starting from line 16 is my code and above that is the solution,l was comparing the two

Thank you
Jagmeet

well, looking at line 16:

def median []:

and comparing that with the solution:

def median(lst):

i see differences. Defining a function has precise syntax. You can’t just alter that.

I have seen else where guys defining a function with an empty list like that

the comment says: list is declared

List are declared with square brackets. Functions are not.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.