Ajax-loader-large-white
Lists and Functions
Printing out a list item by item in a function

This exercise is to 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.
  2. Inside that function, print out each element one by one. Use the existing code as a scaffold.
  3. Then call your function with the argument n.
?
Stuck? Get a hint! Hint
Get live, fast support from Codecademy Advisors when you get stuck. Learn more.

You can simply place the code on lines 3 - 4 inside a function definition. Make sure to indent properly! And you'll have to change the n to x

script.py