Last Friday of each month: Difference between revisions

Content added Content deleted
(→‎{{header|Python}}: added a simpler version)
Line 2,353: Line 2,353:


=={{header|Python}}==
=={{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
<lang python>import calendar
c=calendar.Calendar()
c=calendar.Calendar()