我感觉小甲鱼这个代码有争议,如哪里不对还请多指教。比如begin=[2022,2,22,16,30,31],end=[2022,3,22,15,30,30] ,按照小甲鱼的代码则输出[-2,11,28,22,58,59] 我觉得正确答案应该是[0,0,30,22,59,59] ,下列是我的转换代码:
def t(begin,end):
lasted=[]
borrow = [0, 12, 31, 24, 60, 60]
for index in range(6):
lasted.append(end[index]-begin[index])
while index:
if lasted[index]<0:
lasted[index-1]-=1
lasted[index]=borrow[index]+lasted[index]
index-=1
for each in lasted:
print(each)