Sep-21-2019, 10:41 PM
Thanks a lot ! I didn't give it a look though, but I'll definitely do it tomorrow, it looks pretty powerful :D
In the end, I just wrote one of the least efficient code I've ever created:
In the end, I just wrote one of the least efficient code I've ever created:
def main(lis, valInit, valcherchee): valref=valInit for a in range (len(lis)): valInit+=lis[a] if -1<valInit<1: return a else : for b in range(a+1, len(lis)): valInit+=lis[b] if -1<valInit<1: return a,b else: for c in range(b+1, len(lis)): valInit+=lis[c] if -1<valInit<1: return a,b,c else: for d in range(c+1, len(lis)): valInit+=lis[d] if -1<valInit<1: return a,b,c,d valInit=valref+lis[a]+lis[b]+lis[c] valInit=valref+lis[a]+lis[b] valInit=valref+lis[a] valInit=valrefwhith a few more lines. It worked anyway, I got where I wanted, but it must be the least efficient way to do it, so I'll work towards improving it, and thanks again for your help !