

What were the other two?
What were the other two?
I’m always moving one (file)part at a time, so that should be fine… I think.
The fact that I need [:-2] suggests that I’m doing something wrong in parsing the input I guess…
This is working for the demo, but not for the actual data. I’m a bit lost on why.
def part1(data: data) -> None:
disk_map, free = gen_disk_map(data.getlines()[0])
for f in free[:-2]:
disk_map[f] = disk_map.pop(max(disk_map.keys()))
print(sum([k * v for k, v in disk_map.items()]))
def gen_disk_map(raw: str):
file_id = 0
pos = 0
disk_map, free = {}, []
for read_index, val in enumerate(map(int, raw)):
if read_index % 2 == 0:
for _ in range(val):
disk_map[pos] = file_id
pos += 1
file_id += 1
else:
free.extend(range(pos, pos + val))
pos += val
return disk_map, free
I wasn’t being sarcastic, but yeah even better
I like how clean this is
It looks quite functional indeed
I’m not even sure how to write most of these characters
Part1:
matches = re.findall(r"(mul\((\d+),(\d+)\))", input)
muls = [int(m[1]) * int(m[2]) for m in matches]
print(sum(muls))
Part2:
instructions = list(re.findall(r"(do\(\)|don't\(\)|(mul\((\d+),(\d+)\)))", input)
mul_enabled = True
muls = 0
for inst in instructions:
if inst[0] == "don't()":
mul_enabled = False
elif inst[0] == "do()":
mul_enabled = True
elif mul_enabled:
muls += int(inst[2]) * int(inst[3])
print(muls)
Yes, JD Vance lied about abortion, and no, you shouldn’t trust anything he or Donald Trump says.
Title fix :)
Any moment now
Google cache?
You are not wrong
And the branch should be alive a shorter period
Might as well fly, the plane is going regardless ಠ_ಠ
What about dickbut ?
Diclofenac was my aid to sleep with a broken arm
Sigh. Have my upvote
I wonder which company makes these Chromecasts 🙃