类别:数据智能 / 日期:2025-05-09 / 浏览:6 / 评论:0
4949澳门精准免费大全2025
以下是判断闰年的Python代码:
def is_leap_year(year): if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0): return True else: return False year_to_check = 2024 # 将要检查的年份 if is_leap_year(year_to_check): print(year_to_check, "是闰年") else: print(year_to_check, "不是闰年")
将上述代码中的替换为要检查的年份,运行代码后,它将判断该年份是否为闰年并输出结果。