习题7:更多打印

发布时间:2017-11-07 15:56:58编辑:Run阅读(4320)

    代码如下

    # coding: utf-8
    __author__ = 'www.py3study.com'
    print("Mary had a little lamb.")
    print("Its fleece was white as {}.".format('snow'))
    print("And everywhere that Mary went.")
    print("." * 10) # what'd that do ?
    end1 = 'C'
    end2 = 'h'
    end3 = 'e'
    end4 = 'e'
    end5 = 's'
    end6 = 'e'
    end7 = 'B'
    end8 = 'u'
    end9 = 'r'
    end10 = 'g'
    end11 = 'e'
    end12 = 'r'
    print(end1 + end2 + end3 + end4 + end5 + end6)
    print(end7 + end8 + end9 + end10 + end11 + end12)

    应该看到的结果

    Mary had a little lamb.
    Its fleece was white as snow.
    And everywhere that Mary went.
    ..........
    Cheese
    Burger


    常见问题

    "end"语句是什么原理?

    没有什么end语句,只是变量名里带了个end而已

    为什么要用一个叫"snow"的变量?

    其实不是变量,而是一个带snow的字符串而已,变量是不会带引号的


关键字