i am trying to code an automated notification system which returns a notification (Michael) based on a certain day and time. i used a class object but when it calls the allocated method, it returns no output. the code gives no error which makes it all confusing. i ran the code 2 minutes earlier and when the current time came, nothing happened. this is my first python project.
#import required modules
import datetime
from datetime import date
import calendar
#Get the variable for time right mow
dt = datetime.datetime.now()
#remove the millisecond
x = dt.strftime("%H:%M:%S")
#define class
class Change:
def __init__(self):
# define value for date_str argument in mon method
self.date_str = x
def mon(self, date_str):
if date_str == "10:22:00":
print('michael')
#class instantiation via object
#set value for today's day name
my_date = date.today()
Today = calendar.day_name[my_date.weekday()]
if Today == 'Thursday':
if x == "10:22:00":
#call object when if statement is true
assembly_end_mental_maths_starts = Change()
assembly_end_mental_maths_starts.mon("10:22:00")