my advent of code 2021 solutions
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
639 B

import sys
class line:
def __init__(self, tempinp, tempout):
self.inp = []
self.out = []
self.inp = tempinp.split(' ')
self.out = tempout.split(' ')
def countout(self):
self.count = 0
for digit in self.out:
if 2 <= len(digit) <= 4 or len(digit) == 7:
self.count += 1
return self.count
terminal = []
count = 0
with open(sys.argv[1], 'r') as f:
for i in f.readlines():
tempin = i.strip()
inp, out = tempin.split(' | ')
terminal.append(line(inp, out))
for lin in terminal:
count += lin.countout()
print(count)