• My code works for everything except the extreme

Question related to mission Days Between

 

It even calculates the days, but it does not match the given answer Your result:2921573 Right result:3652058 Fail:days_diff([1,1,1],[9999,12,31])

def days_diff(a, b): from datetime import datetime

newlista = [str(element) for element in list(a)]

for index, item in enumerate(newlista):
    if len(item)==1: newlista[index] ="0" + item

print('Newlista',newlista)

newlistb = [str(element) for element in list(b)]   

for index, item in enumerate(newlistb):
    if len(item)==1: newlistb[index] ="0" + item

print('Newlistb',newlistb)

if len(newlista[0])<3: datea= datetime.strptime('/'.join(newlista),"%y/%m/%d").date()
else: datea= datetime.strptime('/'.join(newlista),'%Y/%m/%d').date()

if len(newlistb[0])<3: dateb= datetime.strptime('/'.join(newlistb),'%y/%m/%d').date()
else: dateb= datetime.strptime('/'.join(newlistb),'%Y/%m/%d').date()

abdiff = datea - dateb

return abs(abdiff.days)