Skip to Content
Learn
Lists and Functions
Modifying each element in a list in a function

This exercise shows how to modify each element in a list. It is useful to do so in a function as you can easily put in a list of any length and get the same functionality. As you can see, len(n) is the length of the list.

Instructions

1.

Create a function called double_list that takes a single argument x (which will be a list) and multiplies each element by 2 and returns that list. Use the existing code as a scaffold.

Folder Icon

Take this course for free

Already have an account?