Files
AoC-2020/day5/day5.py
2020-12-07 00:11:31 +01:00

28 lines
547 B
Python

def getSeatID(boarding_pass):
row = boarding_pass.replace('F', '0').replace('B', '1')[0:7]
column = boarding_pass.replace('L', '0').replace('R', '1')[7:10]
row = (int('0b' + row, 2))
column = (int('0b' + column, 2))
return (row * 8) + column
def part1():
file = open("input.txt")
highest = 0
for line in file:
highest = max(getSeatID(line), highest)
print("Part 1: %d" % highest)
def part2():
file = open("input.txt")
print("Part 2:")
if __name__ == "__main__":
part1()
part2()