Traditional Culture Encyclopedia - The 24 Solar Terms - Enter a year at will from the keyboard with Python and work out how many days it is. For example, if you enter 20 19, you must first judge whether it is a leap year.
Enter a year at will from the keyboard with Python and work out how many days it is. For example, if you enter 20 19, you must first judge whether it is a leap year.
#? Century leap year: the century leap year can be divisible by 400.
#? Ordinary leap year: a year divisible by 4 but not by 100 is an ordinary leap year.
#? There are 366 days in leap years and only 365 days in other years.
What if? Int (year)? %? 400? ==? 0:
Return? real
Elif? Int (year)? %? 100? ! =0? And then what? Int (year)? %? 4? ==? 0:
Return? real
Otherwise:
Return? wrong
def? Calculate the number of days in a year (year):
Leap? =? Leap year or non-leap year
What if? Leap:
How many days? =? 366
Run? =? "yes"
Otherwise:
How many days? =? 365
Run? =? "no"
Print("{} year {} is a leap year with {} days. " . Format (year,? Run? Day))
What if? __name__? ==? " __main__ "
Print ("Enter year:")
n? =? Enter ()
Calculate_days_of_year(n) Run the above code and enter 20 19 to get the following results:
- Related articles
- Is the date of the first frost twenty-four solar terms the time of the first frost?
- Often insomnia, how to do?
- What does the heat mean?
- Is it better to plant broad beans deep or shallow?
- What are the 24 solar terms and various festivals, and when are they? Please give a detailed answer.
- April is a day on the earth, and it is the clearest to conceive people.
- Eight-character typesetting huayi net, huayi eight-character typesetting software download
- Jing Yidan said the vernal equinox solar terms video
- Dreaming of heavy snow, many people caught fire in their neighbors' houses.
- Can rain and solar terms be shared in 2022? What should we pay attention to when it rains and solar terms?