Share your repls and programming experiences

← Back to all posts
Timer
mahcarze1 (19)

Don't judge me, this is my first repl i have posted and i am not that good at it

Comments
hotnewtop
ChezCoder (1607)

good feedback, looks like you are trying to clear screen on lines 9-10, I suggest you do this by:

import operating system or os . (Put this in line 1)

import os

replace lines 9 - 10 with:

os.system("clear")

boom!

Also, you can just do while True and happily remove the ender variable! :P

ChezCoder (1607)

One more thing, replace time.sleep(0.99) with time.sleep(1)

TurtleAndrew (211)

This is supper cool and you could make it simpler by making a forever loop by doing: while True: instead of having the ender variable.

mahcarze1 (19)

Thanks for the feedback, I am working on something else so I dont have time to change the Timer

DeBeast591 (141)

I was skeptical at first thinking it was just a simple timer that was about 5-10 lines. Then I ran it and was VERY impressed, great job!

JamesGordon1 (151)

I found something to improve your repl with:
replace

  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")
  print("---------------")

with

print(chr(27)+'[2j')
print('\033c')
print('\x1bc')
mahcarze1 (19)

Thanks for your feedback, I don't know yet how those prints work, so instead I used a for loop.

Rodogg (3)

great for you first Repl

[deleted]

cool

sumpygump (1)

Or how about this?

print("\rElapsed time: {h} hours, {m} minutes, {s} seconds".format(h=h, m=m, s=s), end="")

The \r will make it clear the line, and the end="" will make it so it doesn't go down to the next line. It keeps printing the information on the same line.

Warhawk947 (524)

this is actually very good!

ApoorvAgrawal (51)

Actually, this is more of a stopwatch than a timer

[deleted]

The world!
1 second has passed
2 seconds have passed
3 seconds have passed
4 seconds have passed
5 seconds have passed
Time has began to move again

Coder100 (18929)

Nice! Now add milliseconds :)

import time as timer
while True:
  votes++
  time++
  timer.sleep(1)
mahcarze1 (19)

Thanks for all of your suggestions!
I changed the print("-----------------") sequence with a for loop that runs 31 times
Tell me if it worked and if the timer is accurate