parent
cea2400d6f
commit
c37f6ef263
1 changed files with 13 additions and 0 deletions
@ -0,0 +1,13 @@ |
||||
import re |
||||
|
||||
lines = [l for l in open("input.txt", 'r').read().splitlines()] |
||||
|
||||
summa, x = 0, [] |
||||
|
||||
for l in lines: |
||||
x = [i.span() for i in re.finditer("mul\([0-9]{1,3},[0-9]{1,3}\)", l)] |
||||
for start, end in x: |
||||
tup = l[start:end].split(',') |
||||
summa += int(tup[0][4:]) * int(tup[1][:-1]) |
||||
|
||||
print(summa) |
Loading…
Reference in new issue