Question: 
Write a function to validate a gregorian date.


Model's Code:
def check_date(day, month, year):
    if isinstance(day, str):
        day = int(day)
    if isinstance(month, str):
        month = int(month)
    if isinstance(year, str):
        year = int(year)

    if month < 1 or month > 12:
        return False
    if day < 1:
        return False

    days_in_month = [31, 29 if (year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)) else 28, 
                     31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

    return day <= days_in_month[month - 1]



Sample Correct Code:
import datetime
def check_date(m, d, y):
    try:
        m, d, y = map(int, (m, d, y))
        datetime.date(y, m, d)
        return True
    except ValueError:
        return False


Asserts:
assert check_date(11,11,2002)==True
assert check_date(13,11,2002)==False
assert check_date('11','11','2002')==True


Tests:
Test 1 of 3: PASS
Test 2 of 3: FAIL: AssertionError()

Test 910 of 974: 701/910 (77.03296703296704%): failed