#oop_date_driver.py from Date import Date as Date #example client code: d0 = Date(5,15,1998) print("d0:",d0) d1 = Date(1,25,2020) print("d1:",d1) d2 = Date.from_string("12/23/1999") #String parameter alternate constructor print("d2:",d2) d3 = Date.from_epoch() #no-arg constructor print("d3:",d3) d4 = Date.from_copy(d2) #copy constructor, d2 is parameter to be copied. print("d4:",d4) my_year = 1234 if my_year < Date.VALID_START_YEAR: print("Years before ",Date.VALID_START_YEAR," are no good") #each Date object created increments the numberDates variable. #client can learn its value: d7 = Date.from_copy(d1) print("Number of Date objects created:",Date.getNumberDates()) del d7 Date.decr_count() print("Number of Date objects now:",Date.getNumberDates()) #if reset the application. #Date.clearNumberDates() #tested. works #use the valid day combo checker: if Date.isValidDay(11,31,2020): print("Bad date") if d1 == d1: print("date is equal with itself") if not d1 == d0: print("dates are not equal") d6 = Date(5,15,2020) if d1 == d6: print("date objects with same data") lst = [d0,d1,d2,d3,d4,d6] print(sorted(lst))