I have a program asking user for answers to some riddles and I'd like to implement of stopwatch of sorts. Is it possible to count from 0 to 30, but to make seconds update "over each other", so that it doesn't display:
01
02
03
...
or
01 02 03 ...
but overwrites the same two digits every time. I hope I'm making myself clear.
Here is what I have so far:
start = time.time()
elapsed = 0
while elapsed < 30:
elapsed = time.time() - start
print "%02d" % elapsed
time.sleep(1)
But this prints the seconds in a column. I'd like to display it as I've described above so that prompt "Your answer: " is always in the same place.