aoc-2021/day_3/tobin.py
2021-12-05 16:52:20 +01:00

8 lines
154 B
Python

inp = '01011'
out = 0
for i in range(0, len(inp)):
print(i, len(inp)-i-1)
if inp[i] == '1':
out = out | (1 << (len(inp)-i-1))
print(out)