mirror of
https://gitlab.com/MisterBiggs/aoc2020.git
synced 2025-06-16 06:16:39 +00:00
star 3
This commit is contained in:
parent
ad3b13b1ac
commit
9b807e75af
16
day2/day2.py
Normal file
16
day2/day2.py
Normal file
@ -0,0 +1,16 @@
|
||||
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)
|
1000
day2/input.txt
Normal file
1000
day2/input.txt
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user