I'm learning the Python 3 basics and this is a homework question, I thought it was simple but I'm definitely missing it. I have searched for solutions and can't seem to find anything that DOESN't start with today's date but just any given date.
This exercise is utilizing 'import datetime' and returns the new date 90 days from a given date.
My code is this:
def add90Days(year, month, day):
given_date = datetime.date(year, month, day)
new_date = given_date + datetime.timedelta(days=90)
return new_date
The error is this:
TypeError: add90Days() missing 2 required positional arguments: 'month' and 'day'
Process finished with exit code 1
OR
def add90Days(date):
given_date = datetime.date(date)
new_date = given_date + datetime.timedelta(days=90)
return new_date
with this error:
TypeError: an integer is required (got type datetime.date)
Process finished with exit code 1
Edit:
import datetime
Complete this function to add ninety days to the given date, return the new date
def add90Days(date):
given_date = datetime.date(date)
new_date = given_date + datetime.timedelta(days=90)
return new_date
expected output: 2018-12-30
print(add90Days(datetime.date(2018, 10, 1)))
expected output: 2015-05-12
print(add90Days(datetime.date(2015, 2, 11)))
The calls are prewritten in the exercise as the expected output. I wrote the function but the "def add90days(date)" was prewritten as a starting point for the exercise