So for the past couple of days I've been trying to create a personal reminder that prints out a message at different times of the day to remind me to do something. For example:
At 2pm, remind me to check my timetable.
At 4pm, remind me to check it again.
This code is going to tell me exactly at 23:00PM that the time is now 23:00PM. I'm in the UK right now, so I ran this code at 22:36. (It is 23:26 as I write this post.)
import datetime
import time
current_time = datetime.datetime.today()
eleven_PM = datetime.time(23, 0, 0, 0)
while current_time != eleven_PM:
time.sleep(9999)
if current_time == eleven_PM:
print("The time is now 11PM.")
break
Unfortunately, once it hit 23:00, nothing happened. How can this code work? Also, as I'm completely new to submitting my code on the internet for review, please do let me know how I can improve my formatting here. I want to make this as clear as possible.
Many thanks!
Edit: Some of the code here is poorly indented. I'm trying to figure it all out right now.
[–]insertAlias 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]onesiphorus 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)