逻辑运算符

练习:判断是否为闰年

year=eval(input("请输入年份:"))
pd=True
if year%400==0:
pd=True
elif year%4==0 and year%100!=0:
pd = True
else:
pd=False
if pd==True:
print(str(year) + "是闰年")
else:
print(str(year) + "不是闰年")
原文地址:https://www.cnblogs.com/meng-xiaoyi/p/14246985.html