Last active
December 5, 2020 11:34
-
-
Save rtt/94c51d4613979a153a9eb8d09a711379 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calc(ticket): | |
seat_id = 0 | |
for i, instr in enumerate(ticket): | |
if instr in 'BR': | |
seat_id += 2**(9-i) | |
return seat_id | |
def part_1(data): | |
return max(calc(line) for line in data) | |
if __name__ == '__main__': | |
with open('input5.txt', 'r') as f: | |
inp = f.read().strip().split('\n') | |
print(part_1(inp)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment