master
E. Almqvist 4 years ago
parent 6a2590f66e
commit 4890aa4c3c
  1. 9
      2020/9.py

@ -32,20 +32,13 @@ for i in range(len(nums)):
invalid, invalidindex = valid[1], i
break
def sumlist(l):
ssum = 0
for num in l:
ssum += num
return ssum
stop = False
foundnums = []
for i in range(len(nums)):
for rangei in range(len(nums)):
numlist = nums[i-rangei:i]
if( not invalid in numlist ):
sumnums = sumlist(numlist)
sumnums = sum(numlist)
if(sumnums == invalid):
foundnums = numlist

Loading…
Cancel
Save