实例4:python
生活随笔
收集整理的這篇文章主要介紹了
实例4:python
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
#輸入某年某月某日,判斷這一天是這一年的第幾天?
#!/usr/bin/python
-- coding: UTF-8 --
#!/usr/bin/python
-- coding: UTF-8 --
year=int(2019)
month=int(8)
day=int(13)
months1=[0,31,60,91,121,152,182,213,244,274,305,335,366] #閏年
months2=[0,31,59,90,120,151,181,212,243,273,304,334,365] #平年
if ((year%40)and(year%100!=0)) or((year%1000)and(year%400==0)):
Dth=months1[month-1]+day
else:
Dth=months2[month-1]+day
print (“是該年的第%d天”%Dth)
總結(jié)
以上是生活随笔為你收集整理的实例4:python的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: html鼠标悬停区域拉伸,html –
- 下一篇: 热血江湖游戏窗口化的方法