美文网首页Learn to Code
《笨办法学Python3》练习八:打印,还是打印

《笨办法学Python3》练习八:打印,还是打印

作者: 雨开Ame | 来源:发表于2019-02-28 17:09 被阅读0次

    练习代码

    formatter = "{} {} {} {}"
    
    print(formatter.format(1, 2, 3, 4))
    print(formatter.format("one", "two", "three", "four"))
    print(formatter.format(True, False, False, True))
    print(formatter.format(formatter, formatter, formatter, formatter))
    print(formatter.format(
        "床前明月光",
        "玻璃好上霜",
        "要不及时擦",
        "整不好就得脏"
    ))
    

    Study Drills

    1. Do your checks, write down your mistakes, and try not to make the same mistakes on the next exercise. In other words, repeat the Study Drills from Exercise 7.

    补充

    1. 没啥好说的,就是把字符串常量替换成了变量,再调用变量的format方法,原理都是相同的。

    相关文章

      网友评论

        本文标题:《笨办法学Python3》练习八:打印,还是打印

        本文链接:https://www.haomeiwen.com/subject/gvrkuqtx.html