python - Accounting for Leap year in simple math based program -


this question has answer here:

basically whenever user gives number of days example 10 , starting year 2008 convert days , add years still 2008, how account leap year? example if enter 848 2008 should 2010 2011. far have:

def year_checker(days, year):      convert = days // 365      year = year + convert      return year 

this question different because messes when trying find days between 2 leap years.

https://support.microsoft.com/en-us/kb/214019

this article tells how calculate leap years. implement formula , check leap years, subtract 366 every leap year encountered. hope helps now. improve answer sample code later.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -