📜  Genskill Bootcamp 惊人的 python 程序 - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:18.591000             🧑  作者: Mango

代码示例1
import time

l = 20
q = ['.']*l
i = 0
f = 1
while True:
    i+=1
    p = q[:]
    m = q[:]
    x = i%(l-2)
    p[x], p[x-1], p[x+1], p[x-2], p[x+2] = ["0", "O", "O", 'o', "o"]
    print ("".join(p), end="", flush=True)
    time.sleep(0.05*f)
    print ("\r", end="", flush=True)
    if i%l == 0: f += 1