L = ['Bart', 'Lisa', 'Adam']
for name in L:
print('hello, %s!' % name)
执行该脚本,但出错了,为什么呢?
for n in L:
print('Hello,',n,'!')
print行没有缩进,必须要缩进,才会被视作代码块,循环执行.
Sign in to make a reply
微尘初心
L = ['Bart', 'Lisa', 'Adam']
for name in L:
print('hello, %s!' % name)