diff --git a/days/01-03-datetimes/code/datetime_date.py b/days/01-03-datetimes/code/datetime_date.py index 05bc842f..27dab6c1 100644 --- a/days/01-03-datetimes/code/datetime_date.py +++ b/days/01-03-datetimes/code/datetime_date.py @@ -2,6 +2,7 @@ from datetime import datetime from datetime import date +from sys import intern datetime.today() #datetime.datetime(2018, 2, 19, 14, 38, 52, 133483) @@ -31,11 +32,13 @@ #19 -christmas = date(2018, 12, 25) -christmas -#datetime.date(2018, 12, 25) +christmas = date(date.today().year, 12, 25) -if christmas is not todaydate: +# This function allows you to compare their memory addresses rather than comparing the strings character-by-character: +a = intern(str(todaydate)) +b = intern(str(christmas)) + +if a is not b: print("Sorry there are still " + str((christmas - todaydate).days) + " until Christmas!") else: print("Yay it's Christmas!")