12/18 Lists anf Functions PLEASE HELP


#1

I don't understand what I'm doing wrong.... It keep telling me The body of your function should not contain any references to 'n'

n = [3, 5, 7]

for i in range(0, len(n)):
print n[i]

----------------------------- (delete the top part)
def print_list(x):
for i in range(0, len(x)):
print x[i]
print_list(n)

EDIT: SOLVED


#2

You have to delete the first part....
n = [3, 5, 7]

for i in range(0, len(n)):
print n[i]

and add n= [3,5,7] before the rest of your code


#3

Could you please tell me which exercise you are currently at?


#4

try this
n = [3, 5, 7]

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

its not indented here so make sure to indent


#5

You could also just type:

for i in x: #Works for lists :slightly_smiling:


#6

i think it has alotta ways , thats just how i did it xD


#7

Lesson 12 in Lists and Functions


#8

Your code works fine when you delete the first for-loop.

n = [3, 5, 7]

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

Didn't you pass the lesson?