1.代码
代码如下:
year = int(input('请输入一个年份:'))
if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0:
print(year,'是闰年!!!')
else:
print(year,'不是闰年!!!')
2.运行结果
D:\Python代码\Scripts\python.exe C:/Users/Lenovo/PycharmProjects/pythonFirstStart/实验二/demo1.py
请输入一个年份:2002
2002 不是闰年!!!
Process finished with exit code 0