Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created January 16, 2021 11:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save amankharwal/c4b94a9e638c4aaff5bd5919f868a85b to your computer and use it in GitHub Desktop.
Save amankharwal/c4b94a9e638c4aaff5bd5919f868a85b to your computer and use it in GitHub Desktop.
from datetime import datetime
from playsound import playsound
alarm_time = input("Enter the time of alarm to be set:HH:MM:SS\n")
alarm_hour=alarm_time[0:2]
alarm_minute=alarm_time[3:5]
alarm_seconds=alarm_time[6:8]
alarm_period = alarm_time[9:11].upper()
print("Setting up alarm..")
while True:
now = datetime.now()
current_hour = now.strftime("%I")
current_minute = now.strftime("%M")
current_seconds = now.strftime("%S")
current_period = now.strftime("%p")
if(alarm_period==current_period):
if(alarm_hour==current_hour):
if(alarm_minute==current_minute):
if(alarm_seconds==current_seconds):
print("Wake Up!")
playsound('audio.mp3')
break
@Hadeel6788
Copy link

``

@ShwetaMathapati
Copy link

Is this code incomplete?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment