AdventOfCode2020/day3.py

41 lines
631 B
Python
Raw Permalink Normal View History

2022-12-17 20:35:26 +01:00
2022-12-14 13:49:00 +01:00
day = "day3"
file = f"inputs/{day}.txt"
array = []
def part_one(file):
result = 0
input = open(file, "r")
input = input.readlines()
2022-12-17 20:35:26 +01:00
newInput = []
for line in input:
temp = 10*line
newInput.append(temp)
print(newInput[0])
startIndex=0
for line in newInput:
if(line[startIndex] == '#'):
result += 1
if startIndex <= len(line) -10:
startIndex +=3
2022-12-14 13:49:00 +01:00
2022-12-14 15:41:25 +01:00
2022-12-14 13:49:00 +01:00
print(f"Part 1: {result}")
part_one(file)
def part_two(file):
result = 0
input = open(file, "r")
input = input.readlines()
print(f"Part 2: {result}")
part_two(file)