18 lines
444 B
Python
18 lines
444 B
Python
|
def mid(values: list[str]):
|
||
|
return values[len(values)//2]
|
||
|
|
||
|
rules,updates = {}, []
|
||
|
with open('sample.data') as data:
|
||
|
for line in data:
|
||
|
if '|' in line:
|
||
|
left, right = [int(i) for i in line.split('|')]
|
||
|
if left in rules:
|
||
|
rules[left].append(right)
|
||
|
else:
|
||
|
rules[left] = [right]
|
||
|
if ',' in line:
|
||
|
updates.append([int(i) for i in line.split(',')])
|
||
|
|
||
|
|
||
|
|