initial commit
This commit is contained in:
commit
27fe77bbe1
134 changed files with 21939 additions and 0 deletions
15
2020/Day2/main.py
Normal file
15
2020/Day2/main.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
if __name__ == '__main__':
|
||||
with open("input.txt") as f:
|
||||
inputs = f.readlines()
|
||||
result = 0
|
||||
entered = 0
|
||||
for i in inputs:
|
||||
rng, let, text = i.split(" ")
|
||||
for x in range(0, len(text)):
|
||||
letequal = text[x] == let[0]
|
||||
if (letequal and x == int(rng.split("-")[0])-1) ^ (letequal and x == int(rng.split("-")[1])-1):
|
||||
entered += 1
|
||||
if entered == 1:
|
||||
result += 1
|
||||
entered = 0
|
||||
print(result)
|
||||
Loading…
Add table
Add a link
Reference in a new issue