要计算闰年,可以使用以下Python代码: ```python def is_leap_year(year): if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0): return True else: return False year = int(input("请输入年份: ")) if is_leap_year(year): print(f"{year}是闰年") else: print(f"{year}不是闰年") ``` [2024-05-29 23:31:45 | AI写代码神器 | 127点数解答]