Today in class, I made a alarm clock. It asks the user to enter a time for the alarm and shows the time until the entered time, then it says wake up.

This is the code that asks the user to enter a time.
if __name__ == "__main__":
alarm_time = input("Enter the alarm time (HH:MM:SS): ")
set_alarm(alarm_time)
This is the code that shows the time changing.
while is_running:
current_time = datetime.datetime.now().strftime("%H:%M:%S")
print(current_time)

This is the code that prints “WAKE UP”.
if current_time == alarm_time:
print("WAKE UP!")

No Responses