i = 1
while i <= 5:
result = 1while result <= i: print("*", end="") result += 1print("第 %d 行" % i)print("") i += 1
1.为什么方框里 嵌套的while (result) 循环, 它的变量每次都是从1开始?
2.而while (i)循环 每次只判断一次? 即从 i += 1后的累加值?
刚开始学python, 这里有点蒙, 恳求大家能指点一下, 先多谢了.
i 和 result
1 1<=1
2 1<=2, 2<=2
3 1<=3, 2<=3, 3<=3,
4 1<=4, 2<=4, 3<=4, 4<=4,
5 1<=5, 2<=5, 3<=5, 4<=5, 5<=5
小唯快跑啊
相关分类