15 lines
511 B
Python
15 lines
511 B
Python
|
from itertools import islice, cycle
|
||
|
|
||
|
from local import is_leap_year
|
||
|
from a import weekday_newyear
|
||
|
from b import is_workday
|
||
|
|
||
|
def workdays_in_year(year):
|
||
|
firstDay = weekday_newyear(year)
|
||
|
cycler = islice( cycle(range(7)), firstDay, None)
|
||
|
days = [next(cycler) for day in range((366 if is_leap_year(year) else 365))]
|
||
|
workdays = [day for day in days if day < 5]
|
||
|
return len(workdays)
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
_ = [print(f'{year} har {workdays_in_year(year)} arbeidsdager') for year in range(1900, 1920)]
|