[In]
x=0
numbers=[]
while x <6: #當變數大於6中斷迴圈
    print(f"At the top is  {x}")
    numbers.append(x) #把X增加到串列裡面
    x=x+1
    print("Numbers now:"),numbers
    print(f"{x} is at the bottom")
    print("The numbers:")
for number in numbers:
     print(number)
[Out]
At the top is  0
Numbers now:
1 is at the bottom
The numbers:
At the top is  1
Numbers now:
2 is at the bottom
The numbers:
At the top is  2
Numbers now:
3 is at the bottom
The numbers:
At the top is  3
Numbers now:
4 is at the bottom
The numbers:
At the top is  4
Numbers now:
5 is at the bottom
The numbers:
At the top is  5
Numbers now:
6 is at the bottom
The numbers:
0
1
2
3
4
5
https://ppt.cc/fopYQx
https://ppt.cc/f23jJx