mirror of
https://github.com/thib8956/advent-of-code.git
synced 2025-08-24 08:21:57 +00:00
make 2020 compatible with run.py
This commit is contained in:
14
2020/day2/day2.py
Normal file
14
2020/day2/day2.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import part1
|
||||
import part2
|
||||
|
||||
|
||||
def main(lines):
|
||||
part1.main(lines)
|
||||
part2.main(lines)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import fileinput
|
||||
lines = [x for x in fileinput.input()]
|
||||
main(lines)
|
||||
|
@@ -15,14 +15,10 @@ def test_password(line):
|
||||
return count in repeat_range
|
||||
|
||||
|
||||
def main(inp):
|
||||
with open(inp) as passwds:
|
||||
valid_counter = 0
|
||||
for l in passwds:
|
||||
if test_password(l):
|
||||
valid_counter += 1
|
||||
print(f"Number of valid password in input : {valid_counter}")
|
||||
def main(passwds):
|
||||
valid_counter = 0
|
||||
for l in passwds:
|
||||
if test_password(l):
|
||||
valid_counter += 1
|
||||
print(f"Number of valid password in input : {valid_counter}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main('./input.txt')
|
||||
|
@@ -19,14 +19,10 @@ def test_password(line):
|
||||
pwd[second_pos - 1] == letter)
|
||||
|
||||
|
||||
def main(inp):
|
||||
with open(inp) as passwds:
|
||||
valid_counter = 0
|
||||
for l in passwds:
|
||||
if test_password(l):
|
||||
valid_counter += 1
|
||||
print(f"Number of valid password in input : {valid_counter}")
|
||||
def main(passwds):
|
||||
valid_counter = 0
|
||||
for l in passwds:
|
||||
if test_password(l):
|
||||
valid_counter += 1
|
||||
print(f"Number of valid password in input : {valid_counter}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main('./input.txt')
|
||||
|
Reference in New Issue
Block a user