I am no longer stuck but I have a question about this exercise:
Because we are modifying a list inside of a function, I set the function to re-assign the argument lst to lst.append(9), and then return the newly-assigned lst like so:
n = [3, 5, 7] def list_extender(lst) : lst = lst.append(9) return lst print list_extender(n)
Turns out that this does not work and nets me a 'list_extender([1, 2, 3, 4]) returned None, did you remember to return the result?' error message.
This is what works:
n = [3, 5, 7] def list_extender(lst) : lst.append(9) return lst print list_extender(n)
Why does the first function not work? Is it because .append() is actually a function itself and I put in an unnecessary step by re-assigning the lst variable? Am I wrong to treat lst like a variable when defining a function that takes it as an argument? I feel like I am making a conceptual error, and would like to understand what it is.
Sorry for stupid question, am new at this.