代码如下所示: ```python year_str = input("请输入一个年份:") year = int(year_str) if year % 400 == 0: print(f"{year}是闰年") elif year % 100 == 0: print(f"{year}不是闰年") elif year % 4 == 0: print(f"{year}是闰年") else: print(f"{year}不是闰年") ``` 这段代码实现了根据用户输入的年份判断是否为闰年,并输出相应结果。 [2024-04-03 19:19:29 | AI写代码神器 | 273点数解答]