Hello Codecademy Community ,
I’m having issues with this question in the Python 3 practice question:
Write a function named
larger_list that has two parameters named
The function should return the last element of the list that contains more elements. If both lists are the same size, then return the last element of
Here is the code I have written as a response:
#Write your function here def larger_list(1st1, 1st2): if len(1st1) == len(1st2): return (1st1[-1]) elif len(1st2) > len(1st1): return (lst2[-1]) else: return (1st1[-1]) #Uncomment the line below when your function is done print(larger_list([4, 10, 2, 5], [-10, 2, 5, 10]))
I’m continuing to receive this error message, but I’m not sure where I’ve gone wrong.
File "script.py", line 2 def larger_list(1st1,1st2): ^ SyntaxError: invalid syntax
My code is not returning the print command. Please help me figure out this issue, I greatly appreciate your feedback!