I want to get days between two dates.
I got a code, but this is little bit different.
Here is my code.
End date is fixed by 2021/5/4.
yearStart = int(input())
monthStart = int(input())
dayStart = int(input())
yearEnd = 2021
monthEnd = 5
dayEnd = 4
months = [31,28,31,30,31,30,31,31,30,31,30,31]
def isLeapYear(year):
return (year%4==0 and year%100!=0) or year%400==0
def totalDays(year,month,day):
total = year*365+day
for i in range(0,month+1):
total+=months[i]
if isLeapYear:
total+=1
return total
days = totalDays(yearEnd,monthEnd,dayEnd) - totalDays(yearStart,monthStart,dayStart)
print(days)