11. List manipulation in functions


It comes up with this error:

File "python", line 2
def list_extender(1st):
SyntaxError: invalid syntax

I don't see anything wrong with it. What is happening?

n = [3, 5, 7]
def list_extender(1st):
    return 1st
print list_extender(n)


Hello @dillsie,

Variable names in Python cannot start with a number, they must start with letters...




value of my_var should be a valid python variable name.
Which is

  • the uppercase and lowercase letters A through Z,
  • the underscore _ and,
  • except for the first character, the digits 0 through 9

( shortly use pattern /[a-z][a-z0-9_]*/i )_.


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