"""
Sofia has given you a schedule and two dates and told you she needs help planning her weekends.
She has asked you to count each day of rest (Saturday and Sunday) starting from the initial date to final date.
You should count the initial and final dates if they fall on a Saturday or Sunday.

The dates are given as datetime.date (Read about this module here). The result is an integer.

Input: Start and end date as datetime.date.

Output: The quantity of the rest days as an integer.
"""
from datetime import date, timedelta


def checkio(from_date: date, to_date: date) -> int:
    """
        Count the days of rest
    """
    result = 0
    while True:
        if from_date.weekday() == 5 or from_date.weekday() == 6:
            result += 1
        if from_date == to_date:
            break
        else:
            from_date += timedelta(days=1)
    return result


# These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
    assert checkio(date(2013, 9, 18), date(2013, 9, 23)) == 2, "1st example"
    assert checkio(date(2013, 1, 1), date(2013, 2, 1)) == 8, "2nd example"
    assert checkio(date(2013, 2, 2), date(2013, 2, 3)) == 2, "3rd example"

1420ded4dd32d66077ebec904b5703f3e000897b
<mask token>

<mask token>


def checkio(from_date: date, to_date: date) ->int:
    """
        Count the days of rest
    """
    result = 0
    while True:
        if from_date.weekday() == 5 or from_date.weekday() == 6:
            result += 1
        if from_date == to_date:
            break
        else:
            from_date += timedelta(days=1)
    return result


<mask token>

<mask token>


def checkio(from_date: date, to_date: date) ->int:
    """
        Count the days of rest
    """
    result = 0
    while True:
        if from_date.weekday() == 5 or from_date.weekday() == 6:
            result += 1
        if from_date == to_date:
            break
        else:
            from_date += timedelta(days=1)
    return result


if __name__ == '__main__':
    assert checkio(date(2013, 9, 18), date(2013, 9, 23)) == 2, '1st example'
    assert checkio(date(2013, 1, 1), date(2013, 2, 1)) == 8, '2nd example'
    assert checkio(date(2013, 2, 2), date(2013, 2, 3)) == 2, '3rd example'

<mask token>
from datetime import date, timedelta


def checkio(from_date: date, to_date: date) ->int:
    """
        Count the days of rest
    """
    result = 0
    while True:
        if from_date.weekday() == 5 or from_date.weekday() == 6:
            result += 1
        if from_date == to_date:
            break
        else:
            from_date += timedelta(days=1)
    return result


if __name__ == '__main__':
    assert checkio(date(2013, 9, 18), date(2013, 9, 23)) == 2, '1st example'
    assert checkio(date(2013, 1, 1), date(2013, 2, 1)) == 8, '2nd example'
    assert checkio(date(2013, 2, 2), date(2013, 2, 3)) == 2, '3rd example'

"""
Sofia has given you a schedule and two dates and told you she needs help planning her weekends.
She has asked you to count each day of rest (Saturday and Sunday) starting from the initial date to final date.
You should count the initial and final dates if they fall on a Saturday or Sunday.

The dates are given as datetime.date (Read about this module here). The result is an integer.

Input: Start and end date as datetime.date.

Output: The quantity of the rest days as an integer.
"""
from datetime import date, timedelta


def checkio(from_date: date, to_date: date) -> int:
    """
        Count the days of rest
    """
    result = 0
    while True:
        if from_date.weekday() == 5 or from_date.weekday() == 6:
            result += 1
        if from_date == to_date:
            break
        else:
            from_date += timedelta(days=1)
    return result


# These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
    assert checkio(date(2013, 9, 18), date(2013, 9, 23)) == 2, "1st example"
    assert checkio(date(2013, 1, 1), date(2013, 2, 1)) == 8, "2nd example"
    assert checkio(date(2013, 2, 2), date(2013, 2, 3)) == 2, "3rd example"
