I want to add a number of days to a given date without using any library I did this part of code :
Days_in_Month = [31, 27, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
if isBisextile(year):
Days_in_Month[1] = 28
days = int(input("Enter number of days:\n"))
while days > 0:
if isBisextile(year):
Days_in_Month[1] = 28
date += 1
if date > int(Days_in_Month[month-1]):
month += 1
if month > 12:
year += 1
month = 1
date = 1
days -= 1
print("{}/{}/{}".format(date, month, year))
If I test with, for example:
Enter a date:
2/7/1980
Enter number of days:
1460
It yields 2/7/1984 instead of 1/7/1984
Does someone have idea why I have plus one day ?
isBisextilefunction works ?