首页 > Codecademy上python的一道问题卡住了

Codecademy上python的一道问题卡住了

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'


我也刚好练习到这里,遇到跟你一样的问题。
删掉你说的那段就好了。为什么要删掉啊


好吧 - -!我总算看懂了,要把
for i in range(0, len(n)): print n[i]
删掉。是我太......

【热门文章】
【热门文章】