Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Weekend Counter by l.szyman10
from datetime import date
def checkio(from_date, to_date):
"""
Count the days of rest
"""
weeks, days = divmod((to_date-from_date).days+1, 7)
start, end = [day.weekday() for day in (from_date, to_date)]
return weeks*2 + sum([bool(i in range(start, start+days)) for i in (5,6)])
May 19, 2020