怎么判断是不是闰年还是平年

判断一个年份是否为闰年或平年,可以根据以下规则:。

1. 如果一个年份能被4整除,但不能被100整除,则为闰年。

2. 如果一个年份能被400整除,则为闰年。

3. 其他情况下,为平年。

以下是一个示例代码来判断一个年份是否为闰年或平年:。

```python。

def is_leap_year(year):。

if year % 4 == 0 and year % 100 != 0:。

return True。

elif year % 400 == 0:。

return True。

else:。

return False。

year = int(input("请输入一个年份:"))。

if is_leap_year(year):。

print(year, "是闰年")。

else:。

print(year, "是平年")。

```。

您可能还会喜欢:
怎么判断闰年还是平年
怎样判断今年是闰年还是平年
怎样判断闰年和平年
如何判断今年是闰年
今年是闰年还是平年
今年平年还是闰年
今年是平年还是闰年
今年是平年还是不是闰年呢
闰年平年怎么分
什么是闰年平年
怎么算今年是闰年还是平年
今年是平年还是闰年2021
今年是平年还是闰年2024
今年是平年还是闰年怎么算的
今年是闰年还是平年2025