12/18 Printing out a list item by item in a function


#1

INPUT:
n = [3, 5, 7]

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

#for i in range(0, len(n)):

print n[i]

print_list(n)
Replace this line with your code.

OUTPUT:

3
5
7
Error Message:

The body of your function should not contain any references to ‘n’


#2

this code:

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

was provided as scaffold, you wrote new code for your function (and not converting the existing code into a function), which is fine, but then you have to remove the scaffold, otherwise you get this error


#3

Thanks man it worked. I have a question What exactly scaffolding means . I searched in internet didn’t find a convincing answer.


#4

Scaffolding is some code that they give you that is formatted correctly but it needs to be altered in terms of variable names etc. in order to apply properly to the task


#5

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