Sort by

recency

|

3051 Discussions

|

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

    This is correct code and it can also pass the hidden test

    def is_leap(year):
        leap = False
        if(year%400==0):
            return True
        elif(year%100==0):
            return False
        elif(year%4==0):
            return True
        else:
            return False
        return leap
    
    year = int(input())
    print(is_leap(year))
    
  • + 0 comments

    As per the requirement I've created a function and satisfy the possible condition that question mention but I'm confused in this part (This means that in the Gregorian calendar, the years 2000 and 2400 are leap years, while 1800, 1900, 2100, 2200, 2300 and 2500 are NOT leap years.) Here we need to apply some condition

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

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

  • + 0 comments

    def is_leap(year): leap = False

    # Write your logic here
    if year%400==0:
        leap = True
    elif year%100==0:
        leap = False
    elif year%4==0:
        leap = True
    
    
    return leap
    
  • + 0 comments

    def is_leap(year): leap = False

    # Write your logic here
    if year%400==0:
        leap = True
    elif year%100==0:
        leap = False
    elif year%4==0:
        leap = True
    
    
    return leap