Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
To_ordinal solution in Clear category for Weekend Counter by pythonist
from datetime import date
def checkio(fr, to):
'''The function returns the count of rest days in the period'''
fr = date.toordinal(fr) # To int
to = date.toordinal(to) # To int
c = 0
for day in range(fr, to + 1):
if date.weekday(date.fromordinal(day)) > 4:
c += 1
return(c)
Sept. 24, 2013
Comments: