So Day 5, ended up being a bit easier than I though it would be. The puzzle involves locating your seat on the plane using Binary. Tickets have a code on them like “FBFBBFFRLR” and the code corresponds to “Front, Back, Left, Right. I started off working up some conditionals that would add or subtract values.

Then I had a brief epiphany moment, that the values are literally just Binary values using letters instead of 1s and 0s. So instead I wrote a quick bit that would convert each seat value into a binary number for Column and Row, then both Part 1 and Part 2 was some quick math checks. Part 1 was to calculate the highest seat number, Part 2 was to find the missing seat that was your seat.

I used basically the same code for both.

with open('day5data.txt') as f:
    lines = [line.rstrip() for line in f]

row='0b'
col='0b'

largest=0
ids=[]

#binary Exclusion
#0-127
#0-7

for line in lines:
  if line != '':
     for i in line:
       if i == 'F':
         row=row+'0'
       if i == 'B':
         row=row+'1'
       if i == 'L':
         col=col+'0'
       if i == 'R':
         col=col+'1'
     current=(eval(row))*8+eval(col)
     ids.append(current)

     if current>largest:
       largest=current


     row='0b'
     col='0b'

ids=sorted(ids)
#print ids

prev=ids[0]
now=ids[1]

for next in ids[2:]:
   if next-1 != now:
     print next-1
   prev=now
   now=next



print largest

This one seemed daunting but went by super quick once I figured out the trick.