Day 8 Part 1.
This commit is contained in:
29
2021/8/main.py
Normal file
29
2021/8/main.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# 0: 1: 2: 3: 4:
|
||||
# aaaa .... aaaa aaaa ....
|
||||
# b c . c . c . c b c
|
||||
# b c . c . c . c b c
|
||||
# .... .... dddd dddd dddd
|
||||
# e f . f e . . f . f
|
||||
# e f . f e . . f . f
|
||||
# gggg .... gggg gggg ....
|
||||
|
||||
# 5: 6: 7: 8: 9:
|
||||
# aaaa aaaa aaaa aaaa aaaa
|
||||
# b . b . . c b c b c
|
||||
# b . b . . c b c b c
|
||||
# dddd dddd .... dddd dddd
|
||||
# . f e f . f e f . f
|
||||
# . f e f . f e f . f
|
||||
# gggg gggg .... gggg gggg
|
||||
|
||||
total = 0
|
||||
with open('data', 'r') as fp:
|
||||
# NOTE(dev): We assume all lines are the same length
|
||||
for line in fp:
|
||||
line = line.split(' | ')[1]
|
||||
vals = line.split()
|
||||
for val in vals:
|
||||
if(len(val) in [2, 3, 4, 7]):
|
||||
total += 1
|
||||
|
||||
print(total)
|
||||
Reference in New Issue
Block a user