Discuss / Python / 作业

作业

Topic source

微尘初心

#1 Created at ... [Delete] [Delete and Lock User]

L = ['Bart', 'Lisa', 'Adam']

for name in L:

print('hello, %s!' % name)

执行该脚本,但出错了,为什么呢?

L = ['Bart', 'Lisa', 'Adam']

for n in L:

    print('Hello,',n,'!')

sunshine_cxc

#4 Created at ... [Delete] [Delete and Lock User]

print行没有缩进,必须要缩进,才会被视作代码块,循环执行.


  • 1

Reply