![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
零基础
星光り灿烂186
这个作者很懒,什么都没留下…
展开
-
Python--for循环最终版
//小星星的输出 # 定义一个变量 # i = 1 # while i <= 5: # print("*" * i) # i += 1 row = 1 while row <= 5: # 增加一个小的循环,专门负责当前行中每一列的星星显示 col = 1 while col <= row: print("*", end="") col += 1 # 能过使星星输出以后换行 print("") .原创 2021-11-20 22:17:28 · 429 阅读 · 0 评论 -
Python--for循环进阶版
# 0~100之间的时间求和 # 定义最终结果 result = 0 # 定义一个变量 i = 0 # 循环 while i <= 100: print(i) # 每次循环,都让result这个变量和i相加 result += i i += 1 print("0~100之间的数字求和结果 = %d" % result) //偶数求和 # 定义俩个变量 result = 0 i = 0 while i <= 100: # 判断变量 i 中的数值,是.原创 2021-11-20 22:15:33 · 883 阅读 · 0 评论