Sort by

recency

|

3079 Discussions

|

  • + 0 comments

    Here is Write a function solution - https://programmingoneonone.com/hackerrank-write-a-function-solution-in-python.html

  • + 0 comments
    def is_leap(year):
        return (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0)
    
    year = int(input())
    print(is_leap(year))
    

    This is the more standard way!

  • + 0 comments
    def is_leap(year):
        leap = False
        
        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))
    
  • + 0 comments

    2100 is not showing True

  • + 0 comments
    if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):
            leap = True
        else:
            0