initial commit
This commit is contained in:
commit
27fe77bbe1
134 changed files with 21939 additions and 0 deletions
17
2020/Day5/main.py
Normal file
17
2020/Day5/main.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
if __name__ == '__main__':
|
||||
highest = 0
|
||||
with open("input.txt", "r") as f:
|
||||
raw = f.read().split("\n")
|
||||
|
||||
seatIDs = []
|
||||
|
||||
for less in raw:
|
||||
row = int(less[:7].replace("F", "0").replace("B", "1"), 2)
|
||||
seatnum = int(less[-3:].replace("L", "0").replace("R", "1"), 2)
|
||||
seatID = row*8+seatnum
|
||||
seatIDs.append(seatID)
|
||||
|
||||
seatIDs = sorted(seatIDs)
|
||||
|
||||
mySeat = set(range(seatIDs[0], seatIDs[-1])) - set(seatIDs)
|
||||
print(mySeat)
|
||||
Loading…
Add table
Add a link
Reference in a new issue