题目: 计算今年是不是闰年? 闰年的条件: 满足整除400,或者整除4而不能整除100.
#coding:utf-8
'''
check this year is a leap year or not
'''
import time
# get this year
this_year = time.localtime()[0]
#this_year = 2008 #you can test any year you want
print ('This year is: %s . ' % this_year)
# check this year if is a leap year, and print the check result.
if this_year%400 == 0 or this_year%4 == 0 and this_year%100 != 0:
print ('It is a leap year.')
else:
print ('It is not a leap year.')