Learn
This exercise will go over how to utilize every element in a list in a function. You can use the existing code to complete the exercise and see how running this operation inside a function isn’t much different from running this operation outside a function.
Don’t worry about the range
function quite yet—we’ll explain it later in this section.
Instructions
1.
Define a function called print_list
that has one argument called x
.
Inside that function, print out each element one by one. Use the existing code as a scaffold.
Then call your function with the argument n
.
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.