import time
x = 0
while True:
print(x)
x =1
time.sleep(5)
if x == 50:
#run a timer while x is still printing until the timer goes down to 0, then it automatically resets x
CodePudding user response:
start = time.time()
x = 0
while True:
while time.time() - start < 1:
print(x)
x =1
x=0
start = time.time()
This will reset your x value every one second.
CodePudding user response:
import time
x = 0
while True:
print('\r',x,end=' ')
x =1
time.sleep(5)
if x == 50:
x = 0