for i in range(3):
print(i)
0
1
2
0 1 2
from sys import stdout
from time import sleep
PAUSE = 1
START_STEP = -15
END_STEP = 15
for sec in range(START_STEP, END_STEP):
if sec == START_STEP:
stdout.write(f'Timer: {sec}')
else:
for _ in range(len(str(prev_sec))):
stdout.write('\033[D \033[D')
stdout.write(f'{sec}')
stdout.flush()
prev_sec = sec
sleep(PAUSE)
print()
from time import sleep
pause = 0.3
start = -15
stop = 16
print('Timer: ', end='')
for sec in range(start, stop):
if sec > start:
print('\b' * cut_num, end='')
print(f'{sec}', end='')
cut_num = len(f'{sec}')
sleep(pause)