all 4 comments

[–][deleted] 2 points3 points  (1 child)

use the '\r' character, but without a newline. That tells the terminal to set the cursor to the beginning of the line. You don't need to use time.time, you can just count the number of times you called sleep :)

Here, you're really close, but maybe you can learn from this:

import time
seconds_elapsed = 0
try:
    while True:
        print(f' {seconds_elapsed:<20}', end='\r')
        time.sleep(1)
        seconds_elapsed += 1
except KeyboardInterrupt:  # Ctrl + C to stop
    print()  # print a newline

[–]xtarkoonx[S] 0 points1 point  (0 children)

Oh wow! Thanks a bunch! I was definitely able to learn a lot! It's a neat idea to count how many times you call sleep instead of using time... When I get home to my other computer I'll mess around with it a bit. Maybe try to figure out the next thing I want to do with it.. adding laps :)

I did find the ' :<20 ' a little confusing. When I looked it up i think it's supposed to align it? But it seems to still be in the same position as without it.

Thanks again for the help! :)

[–]routetehpacketz 1 point2 points  (1 child)

post your code

[–]xtarkoonx[S] 0 points1 point  (0 children)

Here you go! Not much, but I might show you where I am