You can also append or delete items of a list inside a function just as if you were manipulating the list outside a function.

my_list = [1, 2, 3] my_list.append(4) print my_list # prints [1, 2, 3, 4]

The example above is just a reminder of how to append items to a list.



Define a function called list_extender that has one parameter lst.

Inside the function, append the number 9 to lst.

Then return the modified list.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?