12 Lists and Functions


#1

n = [3, 5, 7]

def print_list(x):
for i in range(0, len(x)):
print x[i]

I am stuck


#2

In what way does it misbehave? Explain what we are looking for!

Indentation and such is significant in Python, so make sure it's intact in your post.


#3
n = [3, 5, 7]
def print_list(x):
    x = n
    for i in range(0, len(x)):
        print x[i]

This is how I got it to work.


#4

@austin_w

I typed in:

n = [3, 5, 7]
def print_list(x):
for i in range(0, len(x)):
print x[i]
print print_list(n)

.....and it worked, so you may want to use this because it worked for me


#5

Sorry...you may want to indent all of this because it hasn't automatically done it


#6

I had the same problem, just had to get rid of the exemple script for it to work:
n = [3, 5, 7]

def print_list(x):
for i in range(0, len(x)):
print x[i]

print_list(n)