Sort by

recency

|

3129 Discussions

|

  • + 0 comments

    Very satisfied with commercial roofing Las Cruces and their skilled crew https://roofinglascruse.com/

  • + 0 comments
    if year % 4 == 0:
            if year % 100 == 0:
                if year % 400 == 0:
                    leap = True
                else:
                    leap = False
            else:
                leap = True
        else:
            leap = False
                
        return leap
    

    this the true logic

  • + 0 comments
    if (year%100==0):
        year /= 100
    if (year%4==0):
        leap=True
    

    It's not important to keep the value the same, it's going nowhere else, so modify it if it helps.

  • + 0 comments

    Here's the most efficient way I was able to come up with for this using boolean logic

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

    def is_leap(year): leap = False

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