Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- year = int(input('Please enter a year greater than 100:\n'))
- # if (year <= 100):
- # print('Error: Year {0} is less than or equal to 100'.format(year))
- if year % 4 == 0: # is not divisible by 4, it is not a leap year.
- print('{} is a leap year!'.format(year))
- elif (year % 100 == 0) and (year % 400 == 0): # is divisible by 100 but not by 400, it is not a leap year.
- print('{} is a leap year!'.format(year))
- elif (year % 100 and year % 400): # is divisible by 100 and 400, it is a leap year.
- print('{} is a leap year!'.format(year))
- elif (year % 100 == 0) and (year % 4 == 0): # it is a leap year.
- print('{} is a leap year!'.format(year))
- else:
- print('{} is not a leap year!'.format(year))
- if (year <= 100):
- print('Error: Year {0} is less than or equal to 100'.format(year))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement