Sort by

recency

|

2944 Discussions

|

  • + 0 comments

    return (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0)

  • + 0 comments

    def is_leap(year): leap = False

    return (year % 4 == 0) and (year % 100 != 0 or year % 400 == 0)
    
    return leap
    

    year = int(input()) print(is_leap(year))

  • + 0 comments

    if(year%4==0 and year%100!=0) or (year%400==0): return True else: return False

    this code has worked for me for all the test cases

  • + 0 comments

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

  • + 0 comments

    Something is wrong with the compiler for this question. The test case for 1992 is not returning the same output when I Run Test with Custom Input vs Submit Code. I ran my code locally on my computer and 1992 returns FALSE since it is not a leap year. When I run the same code on the compiler it returns TRUE: def is_leap(year): leap = False

    # Write your logic here
    if year % 4 == 0:
        if (year % 100 == 0) and (year % 400 == 0):
            leap = True
    return leap
    

    year = int(input()) print(is_leap(year))