initial commit, day 10
This commit is contained in:
15
03a.py
Executable file
15
03a.py
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import re
|
||||
|
||||
with open('03a.txt') as f:
|
||||
text = f.read()
|
||||
|
||||
reg = re.compile(r'mul\((?P<num1>[0-9]+),(?P<num2>[0-9]+)\)')
|
||||
|
||||
total = 0
|
||||
|
||||
for match in reg.finditer(text):
|
||||
total += int(match.group('num1')) * int(match.group('num2'))
|
||||
|
||||
print(total)
|
||||
Reference in New Issue
Block a user