Wednesday, April 15, 2020

leap year program using functions in python

def is_leap(year):
    leap = False
    
    # Write your logic here
    if year>= 1900 and year <=10**5:

        if (year % 4) == 0:
            if (year % 100) == 0:
                if (year % 400) == 0:
                     return True
                else:
                    return leap
            else:
                return True
        else:
            return leap
    

year = int(raw_input())
print(is_leap(year))

No comments:

Post a Comment

python class topic video