29 lines
541 B
Python
29 lines
541 B
Python
import operator
|
|
from functools import reduce
|
|
|
|
lines = [x.strip() for x in open("input.txt")]
|
|
|
|
pos = 0.0
|
|
count = 0
|
|
factors = []
|
|
|
|
|
|
def prod(iterable):
|
|
return reduce(operator.mul, iterable, 1)
|
|
|
|
|
|
for movement in [1, 3, 5, 7, 0.5]:
|
|
count = 0
|
|
for line in lines:
|
|
if isinstance(pos, int) or pos.is_integer():
|
|
pos = int(pos)
|
|
pos = pos % len(line)
|
|
if line[pos] == '#':
|
|
count += 1
|
|
pos += movement
|
|
factors.append(count)
|
|
pos = 0
|
|
|
|
print(factors)
|
|
print(prod(factors))
|