We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4e25c96 commit f1cfaecCopy full SHA for f1cfaec
Numbers/alarm.py
@@ -0,0 +1,22 @@
1
+"""
2
+Alarm Clock - A simple clock where it plays a sound after
3
+X number of minutes/seconds or at a particular time.
4
5
+
6
+import time
7
+import winsound
8
9
+if __name__ == '__main__':
10
+ hh = input('What hour do you want to wake up (0-23)? ')
11
+ mm = input('What minute do you want to wake up (0-59)? ')
12
13
+ not_alarmed = 1
14
15
+ while(not_alarmed):
16
+ cur_time = list(time.localtime()) # get the time right now
17
+ hour = cur_time[3] # find the hour
18
+ minute = cur_time[4] # and the minute
19
+ if hour == hh and minute == mm:
20
+ winsound.Beep(10000, 100) # play the beep
21
+ not_alarmed = 0 # stop the loop
22
0 commit comments