Advertisement
timber101

timer

Aug 18th, 2019
173
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None
  1. from time import sleep
  2.  
  3. def countdown(t):
  4.     print("counting down")
  5.  
  6.     while t > 0:
  7.         t2 = t
  8.         dayz = t2 // (24 * 3600)
  9.         t2 = t2 % (24 * 3600)
  10.         hourz = t2 // 3600
  11.         t2 %= 3600
  12.         minutez = t2 // 60
  13.         secondz = t2 % 60
  14.         print("d:h:m:s-> %d:%d:%d:%d" % (dayz, hourz, minutez, secondz))
  15.         sleep(1)
  16.         t = t -1
  17.  
  18. tgttimer = float(input("enter timer in seconds: ") )
  19.  
  20. countdown(tgttimer)
  21.  
  22. print("Times Up!")
Advertisement
RAW Paste Data Copied
Advertisement