Instructions
01.Define a function called print_list that has one argument called x.
02.Inside that function, print out each element one by one. Use the existing code as a scaffold.
03.Then call your function with the argument n.
原來的代碼是:
n = [3, 5, 7]
for i in range(0, len(n)):
print n[i]
根據題目要求寫的代碼:
n = [3, 5, 7]
for i in range(0, len(n)):
print n[i]
def print_list(x):
for i in range(0,len(x)):
print x[i]
print_list(n)
不知哪里出錯了,顯示:The body of your function should not contain any references to 'n'
添加回答
舉報
0/150
提交
取消
