My current code:
import datetime
from time import strptime
leapyear = 0
isValid = False
while not isValid:
in_date = input(" Please in put a year in the format dd/mm/yyyy ")
try:
d = strptime(in_date, '%d/%m/%Y')
isValid=True
except:
print ("This is not in the right format")
diff = d -datetime.date.today()
print(in_date)
print(d)
print(diff)
I cannot subtract the two dates, the input date and today's date from each other. It throws a TypeError: unsupported operand type(s) for -: 'time.struct_time' and 'datetime.date'
exception.
Any ideas why?