Skip to content

Commit cb75fbc

Browse files
authored
Merge pull request #1 from Shuchi2211/Shuchi2211-patch-1-1
Create Alarm_Clock.py
2 parents 392a22b + df939a6 commit cb75fbc

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Diff for: Basic Scripts/Alarm_Clock.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from datetime import datetime
2+
from playsound import playsound
3+
alarm_time = input("Enter the time of alarm to be set:HH:MM:SS\n")
4+
alarm_hour=alarm_time[0:2]
5+
alarm_minute=alarm_time[3:5]
6+
alarm_seconds=alarm_time[6:8]
7+
alarm_period = alarm_time[9:11].upper()
8+
print("Setting up alarm..")
9+
while True:
10+
now = datetime.now()
11+
current_hour = now.strftime("%I")
12+
current_minute = now.strftime("%M")
13+
current_seconds = now.strftime("%S")
14+
current_period = now.strftime("%p")
15+
if(alarm_period==current_period):
16+
if(alarm_hour==current_hour):
17+
if(alarm_minute==current_minute):
18+
if(alarm_seconds==current_seconds):
19+
print("Wake Up! It's time!")
20+
playsound('audio.mp3')
21+
break

0 commit comments

Comments
 (0)