Alarm Clock – A simple clock where it plays a sound after X number of minutes/seconds or at a partic
Code to make an Alarm clock using Python
In [16]:
#this module are pre installed with python
import winsound, time, os, platform
In [17]:
def user_input():
"""taking user input"""
hour = int(input('Enter Hours: '))
minute = int(input('Enter Minute: '))
sec = int(input('Enter Second: '))
wait_time = (hour*60*60) + (minute*60) + (sec)
time.sleep(wait_time)
for i in range(5): # Number of repeats
for j in range(9): # Number of beeps
winsound.MessageBeep(-1) # Sound played -1 for default window sound
time.sleep(1) # How long between beeps
user_input() #run runction
In [ ]:
