12/18 What am I missing?


#1

I added lines 2 and 3 but I realized the code runs with or without those lines… I’m very confused.

n = [3, 5, 7]

def print_list(x):
return n[x]

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


#2

Hi @andrh17,

Though your code might run as is, it does not comply with the exercise instructions.

The print_list function should be designed to print all of the items in the list. The for loop should be placed within the function, and should refer to the list via the function parameter, x, rather than via the global variable, n.

After the function is redesigned, call it, passing it n as the argument.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.