1 Star 0 Fork 0

fanyangchu/PythonCode

加入 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("")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fanych/pythoncode.git
git@gitee.com:fanych/pythoncode.git
fanych
pythoncode
PythonCode
master

搜索帮助