1
0
mirror of https://gitlab.com/MisterBiggs/aoc2020.git synced 2025-06-16 06:16:39 +00:00
AoC2020/day2/day2.py
2020-12-07 17:33:12 -07:00

16 lines
361 B
Python

input = open('day2\input.txt','r').readlines()
# print(len(input))
valid = 0
for i in input:
a = int(i.split('-')[0])
b = int(i.split(' ')[0].split('-')[1])
key = i.split(' ')[1][0]
password = i.split(' ')[-1]
if password.count(key) >= a and password.count(key) <= b:
valid = valid+1
print(i)
print(valid)