闰年代码示例如下:```pythonimport datetimedef is_leap_year(year): """ 判断给定年份是否为闰年 """ # 闰年的判断标准 # 4年为闰年,则2月份有29天 # 4年以下为闰年,则2月份有28天 if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0: return True return False# 闰年代码示例print("这是闰年。")print("2023年为闰年,2月份有29天。")print("请编写闰年代码,计算年份是否为闰年。")# 非闰年代码示例print("这是非闰年。")print("2022年为非闰年,2月份有28天。")print("请编写非闰年代码,计算年份是否为闰年。")```