List manipulation in functions 11


#1

Why do I get the following error message?

Oops, try again.
list_extender([1, 2, 3, 4]) returned [3, 5, 7, 9] instead of [1, 2, 3, 4, 9]


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


print list_extender(n)


#2

Maybe you should return the new list? N is the older one, so return lst.


#4

return lst!

def list_extender(lst):
    lst.append(9)
    return lst


print list_extender(n)

#5

I told him to do it already, also the topic is one week old so he probably completed the lesson already.


#6

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