Python自学:第四章 在for循环中执行更多操作(2)

# -*- coding: GBK -*-
magicians = ['alice', 'david', 'carolina']
for magician in magicians:

    print(magician.title() + ", that was a great trick!")
    print("I can't wait to seee your next trick," + magician.title() + ".\n")

输出为:

Alice, that was a great trick!
I can't wait to seee your next trick,Alice.

David, that was a great trick!
I can't wait to seee your next trick,David.

Carolina, that was a great trick!
I can't wait to seee your next trick,Carolina.

 

posted @ 2019-05-06 09:06  Johnson蚂蚁  阅读(222)  评论(0编辑  收藏  举报