用python写一个程序 打印从今年开始之后的20个闰年
时间: 2023-03-30 12:04:55 浏览: 97
很高兴回答你的问题。以下是 Python 代码,可以打印从今年开始之后的20个闰年:
```python
import datetime
now = datetime.datetime.now()
year = now.year
count =
while count < 20:
if (year % 4 == and year % 100 != ) or year % 400 == :
print(year)
count += 1
year += 1
```
希望这个代码对你有帮助。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)