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 = ' ' 能在末尾添加空字符串