37 lines
630 B
Python
37 lines
630 B
Python
day = "day6"
|
|
file = f"inputs/{day}.txt"
|
|
|
|
letters = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
|
|
|
|
def part_one(file):
|
|
result = 0
|
|
input = open(file, "r")
|
|
input = input.read().split("\n\n")
|
|
|
|
for line in input:
|
|
result += check(line)
|
|
|
|
|
|
print(f"Part 1: {result}")
|
|
|
|
|
|
|
|
def check(line):
|
|
counter = 0
|
|
for i in letters:
|
|
if i in line:
|
|
counter += 1
|
|
return counter
|
|
|
|
def part_two(file):
|
|
result = 0
|
|
input = open(file, "r")
|
|
input = input.readlines()
|
|
|
|
|
|
|
|
print(f"Part 2: {result}")
|
|
|
|
|
|
part_one(file)
|
|
part_two(file) |