DaysOld

def isLeapYear(year): ## # Your code here. Return True or False # Pseudo code for this algorithm is found at # http://en.wikipedia.org/wiki/Leap_year#Algorithm ## if year%400 or year%100 or year%4: return True

def daysBetweenDates(year1, month1, day1, year2, month2, day2): ## # Your code here. ## days = 0 while year1 != year2: if isLeapYear(year1): days += 366 else: days += 365 year1 += 1 while month1 != month2: #print month1 days += daysOfMonths[month1-1] month1 += 1 #print("months_days", days) if day2==day1: tage = 1 else: tage = abs(day2-day1) #print("tage", tage) days += tage

print days
return days

Tags: coding

Edit this page
Wiki-logo