|
1 | 1 | #!python3 |
2 | 2 |
|
3 | | -from datetime import datetime |
4 | 3 | from datetime import date |
| 4 | +from datetime import datetime |
5 | 5 |
|
6 | 6 | datetime.today() |
7 | | -#datetime.datetime(2018, 2, 19, 14, 38, 52, 133483) |
| 7 | +# datetime.datetime(2021, 1, 19, 14, 38, 52, 133483) |
8 | 8 |
|
9 | 9 | today = datetime.today() |
10 | 10 |
|
11 | | - |
12 | 11 | type(today) |
13 | | -#<class 'datetime.datetime'> |
| 12 | +# <class 'datetime.datetime'> |
14 | 13 |
|
15 | 14 |
|
16 | | -todaydate = date.today() |
| 15 | +today_date = date.today() |
17 | 16 |
|
18 | | -todaydate |
19 | | -#datetime.date(2018, 2, 19) |
| 17 | +today_date |
| 18 | +# datetime.date(2021, 1, 19) |
20 | 19 |
|
21 | | -type(todaydate) |
22 | | -#<class 'datetime.date'> |
| 20 | +type(today_date) |
| 21 | +# <class 'datetime.date'> |
23 | 22 |
|
24 | | -todaydate.month |
25 | | -#2 |
| 23 | +today_date.month |
| 24 | +# 1 |
26 | 25 |
|
27 | | -todaydate.year |
28 | | -#2018 |
| 26 | +today_date.year |
| 27 | +# 2021 |
29 | 28 |
|
30 | | -todaydate.day |
31 | | -#19 |
| 29 | +today_date.day |
| 30 | +# 19 |
32 | 31 |
|
33 | 32 |
|
34 | | -christmas = date(2018, 12, 25) |
| 33 | +christmas = date(today_date.year, 12, 25) |
35 | 34 | christmas |
36 | | -#datetime.date(2018, 12, 25) |
| 35 | +# datetime.date(2021, 12, 25) |
37 | 36 |
|
38 | | -if christmas is not todaydate: |
39 | | - print("Sorry there are still " + str((christmas - todaydate).days) + " until Christmas!") |
| 37 | +if christmas != today_date: |
| 38 | + print("Sorry there are still " + str((christmas - today_date).days) + " until Christmas!") |
40 | 39 | else: |
41 | 40 | print("Yay it's Christmas!") |
0 commit comments