Sort by

recency

|

2824 Discussions

|

  • + 1 comment

    its showing that 2100 is false though 2100 is not leap year

  • + 0 comments

    if year % 400 == 0: leap = True elif year % 100 == 0: leap = False elif year % 4 == 0: leap = True

  • + 1 comment

    def is_leap(year): leap = False if (year%4==0 & year%100==0) | year%400==0: leap = True # Write your logic here

    return leap
    

    year = int(input())
    its giving test case error pls give me full solution

  • + 0 comments
    def is_leap(year):
        leap = False
        
        if year % 4 == 0 and (year % 100 != 0 or year % 400 == 0):
            leap = True
            
        # 2-d option with builtin function (commented):
        # leap = __import__('calendar').isleap(year)
        
        return leap
    
  • + 0 comments

    def is_leap(year): leap = False if(year%100==0): if(year%400==0): leap = True elif(year%4==0): leap = True else: leap = False return leap

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