3 def get_row(binary_id):
6 selections=[a for a in range(128)]
8 for decision in choices:
9 half_range=int(len(selections)/2)
11 del selections[-half_range:]
13 del selections[:half_range]
17 def get_col(binary_id):
18 choices=binary_id[-3:]
20 selections=[a for a in range(8)]
22 for decision in choices:
23 half_range=int(len(selections)/2)
25 del selections[-half_range:]
27 del selections[:half_range]
31 def get_seat(binary_id):
32 row=get_row(binary_id)
33 col=get_col(binary_id)
37 def get_seat_id(row, col):
38 return ((row * 8) + col)
42 for line in open("input.txt", "r"):
45 (row, col) = get_seat(line)
46 all_seat_ids.append(get_seat_id(row, col))
51 # and print the highest seat id - part 1
52 print("Highest seat id: {}".format(all_seat_ids[-1]))
58 for a,b in enumerate(all_seat_ids, start=all_seat_ids[0]):
63 print("My seat id: {}".format(my_seat_id))