Discuss / Python / 练习

练习

Topic source

zyckhuntoria

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

L = ['Bart', 'Lisa', 'Adam'] for x in L: print(x)

zyckhuntoria

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

我没看清题目 正确解答应该是 L = ['Bart', 'Lisa', 'Adam'] for x in L: print('Hello,',x,'!')

君君开船

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

L = ['Bart', 'Lisa', 'Adam'] for x in L: print('Hello,', x,'!')

打印出来长这样 Hello, Bart ! Hello, Lisa ! Hello, Adam !

名字和叹号中间多一个空格,如何解决?

HansiN_

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

print('Hello,' + x + '!')

print('Hello,' + x + '!') 或者用格式化print("Hello,%s!"%x)


  • 1

Reply