Add one liner
This commit is contained in:
parent
fa259faa2b
commit
e97762a3f7
@ -10,6 +10,9 @@ for match in matches:
|
|||||||
total += int(match[0]) * int(match[1])
|
total += int(match[0]) * int(match[1])
|
||||||
print(total)
|
print(total)
|
||||||
|
|
||||||
|
# One-liner
|
||||||
|
# print(sum(int(x) * int(y) for x, y in re.findall(r"mul\((\d+),(\d+)\)", data, re.MULTILINE)))
|
||||||
|
|
||||||
# Part two
|
# Part two
|
||||||
matches = re.finditer(r"mul\((\d+),(\d+)\)", data, re.MULTILINE)
|
matches = re.finditer(r"mul\((\d+),(\d+)\)", data, re.MULTILINE)
|
||||||
total = 0
|
total = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user