Traditional Culture Encyclopedia - The 24 Solar Terms - Python judges the current solar terms
Python judges the current solar terms
Year = Enter ("Please Enter Year")
Month = input(" "# Pay attention to the month, but it's a month now, not a few months later.
Day =7
Def judge _ leap year (year):
If (year %4==0, year% 100! =0 ):
Return 1
elif(year%400==0):
Return to 2
Otherwise:
Return 0
Year _ day = [3 1,28,3 1,30,3 1,30,3 1,30,3 1]
Leap _ year = [3 1,29,3 1,30,3 1,30,3 1,30,3 1。
Leap _ year _ f = [3 1,30,3 1,30,3 1,30,3 1,3 1,30,365438。
Year_rule=[year_day, leap year, leap year f]
Count_day=0 # Initialization days are 0.
For I (month-1) in the range: # Pay attention to the month, but what month is it now, not several months have passed.
Count _ day+= year _ rule[judge _ leap year (year) ][i]
Print (Counting Days)
Counting Day+= Day
Print ('Today is the first day of this year', count_day,' day')
- Previous article:What are the solar terms behind the autumnal equinox?
- Next article:How to nourish stomach in winter?
- Related articles
- What are the 24 solar terms in the song dynasty?
- Spring cold generally refers to the month.
- Can moxibustion be used in today's severe cold solar terms?
- What food does Tomb-Sweeping Day eat?
- How to keep healthy during the summer solstice solar terms?
- What does middling mean?
- Are the 24 solar terms fixed dates?
- How wonderful is the oil painting Tulip Pizza?
- Xiaoxue solar terms inspirational copy
- How to change the valve seat cushion of the eighth generation Accord?