11, List Manipulation in functions, Getting a syntax error, not sure why?


#1



https://www.codecademy.com/en/courses/python-beginner-nzzVa/2/4?curriculum_id=4f89dab3d788890003000096


Im not sure what im doing wrong here, any help is appreciated, here are the errors i recieved


In the pop up:
Oops, try again. Your code looks a bit off. Check the console window for errors!


In the console window
File "python", line 3
def list_extender(1st):
^
SyntaxError: invalid syntax

(the ^ is pointing up at the 1 in 1st)



Heres my code

n = [3, 5, 7]
# Add your function here
def list_extender(1st):
    1st.append(9)
    return 1st

print list_extender(n)


#2

1st is not a valid identifier, pick a different name starting with something in the range [a-z], something along the lines of lst, sequence, seq, list_object, list_obj


#3

Thanks! a bit odd that it told me to do this in the instructions, or am i misreading them?

Instructions
Define a function called list_extender that has one parameter lst.
Inside the function, append the number 9 to lst.
Then return the modified list.


#4

1 and l may look similar in some fonts, usually you'll want to use something where they are somewhat distinct:


#5

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