您好,欢迎访问一九零五行业门户网

python判断闰年

#-*- coding:utf-8 -*- try: year = int(raw_input('请输入年份(如2008): ')) except: print '请输入正确的年份' exit() is_leap = false if year % 100 == 0 and year % 400 == 0: is_leap = true elif year % 100 != 0 and year % 4 == 0: is_leap = true if is_leap: print '%d年是闰年!' % year else: print '%d年不是闰年!' % year
其它类似信息

推荐信息