in lib/misc.py [0:0]
def _infer_question_mark(x, total_product):
try:
question_mark_index = x.index(["?"])
except ValueError:
return x
observed_product = 1
for i in range(len(x)):
if i != question_mark_index:
assert type(x[i]) is int, f"when there is a question mark, there can be no other unknown values (full list: {x})"
observed_product *= x[i]
assert (
observed_product and total_product % observed_product == 0
), f"{total_product} is not divisible by {observed_product}"
value = total_product // observed_product
x = x.copy()
x[question_mark_index] = value
return x