This is my code:
from datetime import datetime, timedelta
from dateutil.relativedelta import *
date = futuredate = datetime(2021, 4, 12, 0, 0)
date = date + relativedelta(days=11) + relativedelta(years=-1)
I'm trying to loop this part of the code: date = date + relativedelta(days=11) + relativedelta(years=-1)
so that it will stop to the year the user asked for.
For example the user wanted to see the figure for 2001, the code will stop looping when the year reaches 2001.
Additionally, I want the code to switch to days=-11
and years=1
when the user asks for a year that is above 2021.