Given a year, determine whether it is a leap year. If it is a leap year, return the Boolean True, otherwise return False - python3

 def is_leap(year):

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

year = int(input("Input Year :"))
print(is_leap(year))
Next Post Previous Post
No Comment
Add Comment
comment url