• + 0 comments

    Three conditions are used to identify leap years: The year can be evenly divided by 4, is a leap year,

    if year % 4 == 0:
        leap == True
    

    Unless, the year can be evenly divided by 100, it is NOT a leap year,

    if year % 100 == 0:
        leap == False
    

    Unless, the year is also evenly divisible by 400. Then it is a leap year.

    if year % 400  == 0:
        leap == True
    

    EXAMPLE:

    def is_leap(year):
        leap = False
        
        # Write your logic here
        if year % 4 == 0:
            leap = True
        if year % 100 == 0:
            leap = False
        if year % 400 == 0:
            leap = True
            
        return leap
    year = int(input())
    print(is_leap(year))