这个习题比较简单,设计到字符串的相加和相乘!话不多说,直接上代码:
print("Mary had a little lamb")
print("Its fleece was white as %s." %'snow')
print("And everwhere that Mary went.")
print("."*10)
end1 = "C"
end2 = "h"
end3 = "e"*2
end4 = "s"
end5 = "e"
print(end1+end2+end3+end4+end5)
运行结果:
mystuff simengred$ python ex7.py
Mary had a little lamb
Its fleece was white as snow.
And everwhere that Mary went.
..........
Cheese