‘lst’ is an example list which stands for any list that the function could receive. You give it a list when you call it ( e.g. list_extender(n) ). The function basically ‘replaces’ the example list with the list you’ve given it and does with it what you have programmed it to do (append 9).
Hope this helps
hi, i tried the same code with the modification that wizmarco has suggested, but the error message i get is:
File “python”, line 5
SyntaxError: ‘return’ outside function
thx srry to put u through the trouble, I also solved it earlier than your reply but it helps just to know that there is a slightly different answer but srry again for not noticing your reply and once again thank you
n = [3, 5, 7]
def list_extender(lst):# Add your function here
lst.append(9)
return lst
print list_extender(n)
you have a list n[3,5,7] and print list_extender(n) this will print the List n.
then the function you define will add 9 at the end of any list, if you CHANGE the “return lst” to “RETURN n” look what will give you and try to anderstand why!!!