python 判断平年还是闰年

while 1:   
   s = input('请填入一个年份:')
   s = int(s)
   
   year = False
   
   if s % 100 == 0 and s % 400 == 0:
      year = True   

   elif s % 100 != 0 and s % 4 == 0:   

      year = True

   if year:
      print('闰年')
   else:
      print('平年')
         

 

posted @ 2016-06-28 18:37  疯陈演义  阅读(2889)  评论(0编辑  收藏  举报