Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions days/01-03-datetimes/code/datetime_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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!")