欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

笨办法学python习题7 更多打印

程序员文章站 2022-06-15 18:41:30
...

这个习题比较简单,设计到字符串的相加和相乘!话不多说,直接上代码:

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