Advertisement
mengyuxin

count_down.py

Jan 6th, 2018
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. #! python3
  2. # count_down.py - A simple countdown script.
  3.  
  4. import time, subprocess
  5.  
  6. time_left = int(input('Enter a number:'))
  7.  
  8. while time_left > 0:
  9.     print(time_left, end = ' | ')
  10.     time.sleep(1)
  11.     time_left -= 1
  12.  
  13. # At the end of the countdown, play a sound file.
  14. subprocess.Popen(['start', 'alarm.wav'], shell=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement