加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
patterns.py 564 Bytes
一键复制 编辑 原始数据 按行查看 历史
# Lets say we want to print a combination of stars as shown below.
# *
# * *
# * * *
# * * * *
# * * * * *
for i in range(1,6):
for j in range(0,i):
print('*',end = " ")
for j in range(1,(2*(5-i))+1):
print(" ",end = "")
print("")
# Let's say we want to print pattern which is opposite of above:
# * * * * *
# * * * *
# * * *
# * *
# *
print(" ")
for i in range(1,6):
for j in range(0,(2*(i-1))+1):
print(" ", end="")
for j in range(0,6-i):
print('*',end = " ")
print("")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化