Discuss / Python / 作业

作业

Topic source

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

请问怎么才能做到依次打印,就是按一下enter键,出来一个“Hello xxx”

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

前边基础部分有讲到格式化字符串,认真看看


  • 1

Reply