Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
code for a timer
#3
just to mention that you don't need both x and count variables.
import time
def mycounter(lapse):
    for counter in range(lapse):
        time.sleep(1)
        print(counter)
 
mycounter(10)
this will count 10 seconds (0-9)
Reply


Messages In This Thread
code for a timer - by SheeppOSU - Feb-19-2018, 10:53 PM
RE: code for a timer - by sparkz_alot - Feb-20-2018, 01:24 AM
RE: code for a timer - by buran - Feb-20-2018, 11:01 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Running a few lines of code as soon as my timer ends nethatar 3 2,443 Feb-26-2021, 01:02 PM
Last Post: jefsummers
  email timer/rss feed timer ndiniz 1 2,107 Feb-02-2021, 07:18 PM
Last Post: nilamo
  code keeps running if i use from threading import timer? birddseedd 3 2,628 Jan-25-2019, 05:00 AM
Last Post: stullis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020