SHARE
TWEET

Untitled

a guest Feb 17th, 2020 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. year = int(input('Please enter a year greater than 100:\n'))
  2. # if (year <= 100):
  3. #  print('Error: Year {0} is less than or equal to 100'.format(year))
  4.  
  5. if year % 4 == 0:  # is not divisible by 4, it is not a leap year.
  6.     print('{} is a leap year!'.format(year))
  7.  
  8. elif (year % 100 == 0) and (year % 400 == 0):  # is divisible by 100 but not by 400, it is not a leap year.
  9.     print('{} is a leap year!'.format(year))
  10.  
  11. elif (year % 100 and year % 400):  # is divisible by 100 and 400, it is a leap year.
  12.     print('{} is a leap year!'.format(year))
  13.  
  14. elif (year % 100 == 0) and (year % 4 == 0):  # it is a leap year.
  15.     print('{} is a leap year!'.format(year))
  16. else:
  17.     print('{} is not a leap year!'.format(year))
  18. if (year <= 100):
  19.     print('Error: Year {0} is less than or equal to 100'.format(year))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top