码迷,mamicode.com
首页 > 编程语言 > 详细

Python---金字塔1

时间:2020-05-04 19:37:19      阅读:57      评论:0      收藏:0      [点我收藏+]

标签:img   end   app   bar   pop   copy   技术   代码   str   

>>:金字塔1

代码:

技术图片
numbers2 = []
for value in range(0,10):
    number = value+1
    numbers2.append(number)
    print(numbers2)

for value2 in numbers2:
    number2 = value2-1
    munbers2 = numbers2.pop(-1)
    print(numbers2)

for value2 in numbers2:
    number2 = value2-1
    munbers2 = numbers2.pop(-1)
    print(numbers2)    
    
for value2 in numbers2:
    number2 = value2-1
    munbers2 = numbers2.pop(-1)
    print(numbers2)   
    
print("\n")
print(len(numbers2))
技术图片

输出结果:

技术图片
[1]
[1, 2]
[1, 2, 3]
[1, 2, 3, 4]
[1, 2, 3, 4, 5]
[1, 2, 3, 4, 5, 6]
[1, 2, 3, 4, 5, 6, 7]
[1, 2, 3, 4, 5, 6, 7, 8]
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[1, 2, 3, 4, 5, 6, 7, 8]
[1, 2, 3, 4, 5, 6, 7]
[1, 2, 3, 4, 5, 6]
[1, 2, 3, 4, 5]
[1, 2, 3, 4]
[1, 2, 3]
[1, 2]
[1]


1

Python---金字塔1

标签:img   end   app   bar   pop   copy   技术   代码   str   

原文地址:https://www.cnblogs.com/a001ai-es/p/12827593.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!