""" 閏年: 能被4整除,而且不能被100整除 或者 能被4整除,而且又能被400整除 """ while 1: this_time = int(input("請輸入年份:")) #條件1 condition1 = this_time%4 == 0 and this_time%100 != 0 #條件2 condition2 = this_time%4 == 0 and this_time%400 == 0 if (condition1 or condition2): print("%d年是閏年"%(this_time)) else: print("%d年不是閏年"%(this_time))