Day of the week: Difference between revisions

moved python
(→‎{{header|Ada}}: Changed to 2008..2122)
(moved python)
Line 165:
25 Dec 2118 is Sunday
</pre>
 
=={{header|pythonPython}}==
<python>import datetime
 
def yuletide():
sunday = 6
days = (day.strftime('%d %b %Y') for day in (datetime.date(year, 12, 25)
for year in range(2008,2122)) if day.weekday() == sunday)
print '\n'.join(days)
 
yuletide()</python>Output:
<pre>25 Dec 2011
25 Dec 2016
25 Dec 2022
25 Dec 2033
25 Dec 2039
25 Dec 2044
25 Dec 2050
25 Dec 2061
25 Dec 2067
25 Dec 2072
25 Dec 2078
25 Dec 2089
25 Dec 2095
25 Dec 2101
25 Dec 2107
25 Dec 2112
25 Dec 2118</pre>
 
 
=={{header|UNIX Shell}}==
Line 218 ⟶ 247:
Sun Dec 25 00:00:00 GMT 2095
bash-3.00$</pre>
 
=={{header|python}}==
<python>import datetime
 
def yuletide():
sunday = 6
days = (day.strftime('%d %b %Y') for day in (datetime.date(year, 12, 25)
for year in range(2008,2122)) if day.weekday() == sunday)
print '\n'.join(days)
 
yuletide()</python>Output:
<pre>25 Dec 2011
25 Dec 2016
25 Dec 2022
25 Dec 2033
25 Dec 2039
25 Dec 2044
25 Dec 2050
25 Dec 2061
25 Dec 2067
25 Dec 2072
25 Dec 2078
25 Dec 2089
25 Dec 2095
25 Dec 2101
25 Dec 2107
25 Dec 2112
25 Dec 2118</pre>