笨办法学python习题7
Posted shadowyuriya
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了笨办法学python习题7相关的知识,希望对你有一定的参考价值。
1.注释
1 #打印Mary had a little lamb. 2 print("Mary had a little lamb.") 3 #在Its fleece was white as后插入字符串snow,并且打印 4 print("Its fleece was white as {}.".format(‘snow‘)) 5 #打印And everywhere that Mary went. 6 print("And everywhere that Mary went.") 7 #打印10个“.”:.......... 8 print("."*10) #What‘d that do? 9 10 #w为end1-12分别赋值 11 end1 = "C" 12 end2 = "h" 13 end3 = "e" 14 end4 = "e" 15 end5 = "s" 16 end6 = "e" 17 end7 = "B" 18 end8 = "u" 19 end9 = "r" 20 end10 = "g" 21 end11 = "e" 22 end12 = "r" 23 24 # watch that camma at the end. try removing it to see what happens 25 #将end1-6合并,加空格,打印 26 print(end1 + end2 + end3 + end4 + end5 + end6, end = ‘ ‘) 27 #将end7-12合并,打印 28 print(end7 + end8 + end9 + end10 + end11 + end12)
* end = ‘ ‘ 能在末尾添加空字符串
以上是关于笨办法学python习题7的主要内容,如果未能解决你的问题,请参考以下文章
笨办法学 Python (Learn Python The Hard Way)
笨办法学 Python(第三版)习题 18: 命名变量代码函数