1 Star 0 Fork 0

fanyangchu/PythonCode

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
To print series 1,12,123,1234......py 743 Bytes
一键复制 编辑 原始数据 按行查看 历史
# master
def num(a):
# initialising starting number
num = 1
# outer loop to handle number of rows
for i in range(0, a):
# re assigning num
num = 1
# inner loop to handle number of columns
# values changing acc. to outer loop
for k in range(0, i+1):
# printing number
print(num, end=" ")
# incrementing number at each column
num = num + 1
# ending line after each row
print("\r")
# Driver code
a = 5
num(a)
# =======
# 1-12-123-1234 Pattern up to n lines
n = int(input("Enter number of rows: "))
for i in range(1,n+1):
for j in range(1, i+1):
print(j, end="")
print()
# master
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fanych/pythoncode.git
git@gitee.com:fanych/pythoncode.git
fanych
pythoncode
PythonCode
master

搜索帮助