Anonymous user
Last Friday of each month: Difference between revisions
→{{header|Python}}: added a simpler version
(→{{header|Python}}: added a simpler version) |
|||
Line 2,353:
=={{header|Python}}==
<lang python>import calendar
def lastFridays(year):
for month in range(1, 13):
last_friday = max(week[calendar.FRIDAY]
for week in calendar.monthcalendar(year, month))
print('{:4d}-{:02d}-{:02d}'.format(year, month, last_friday))</lang>
Or
<lang python>import calendar
c=calendar.Calendar()
|