List Manipulation in Functions


#1



dont see where im going wrong here. getting the error message " Oops, try again. list_extender([1, 2, 3, 4]) returned [1, 2, 3, 4] instead of [1, 2, 3, 4, 9] "


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


print list_extender(n)


#2

just realised i needed to put lst.append instead of n.append. My bad!!


#3

I have a dumb question. Why do you have to use lst.append(9)? In the example they use the name of the list when appending.


#4

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