May 12, 2010 11:29
# -*- coding: cp1251 -*-
import calendar as c
def workDays(Y,M):
lenghMonth = len(c.monthcalendar(Y,M))
nameMonth = c.month_name[M]
Range = [0, lenghMonth-1]
day = 0
for i in Range:
for k in range(len(c.monthcalendar(Y,M)[i])-2):
if c.monthcalendar(Y,M)[i][k] != 0:
day += 1
return 5*(lenghMonth-2) + day, nameMonth
year = raw_input('Input year: ')
for i in range(1,13):
days, month = workDays(int(year),i)
print 'In %s working days - %s.' % (month, days)
lab#04,
python